Just Python Script (JPS) - A Python-like language that compiles to JavaScript
npm install jpsxbash
Install as a library in your project
npm install jpsx
Or install globally as a CLI tool
npm install -g jpsx
`
$3
Import .jps files directly in your code - just like .tsx files!
math.jps
`python
def add(a, b):
return a + b
class Calculator:
def __init__(self):
self.value = 0
`
App.tsx
`typescript
import { add, Calculator } from './math.jps';
const sum = add(10, 20);
const calc = new Calculator();
`
---
✨ Features
- 🐍 Python-like syntax that compiles to clean JavaScript
- ⚡ Standalone file integration - Import .jps files like .jsx/.tsx files!
- 🔥 Hot Module Replacement (HMR) - Instant feedback during development
- ⚡ Zero-config integration with React, Vue, Svelte, Angular, and more
- 📦 Multiple output formats: ESM, CommonJS, IIFE, UMD
- 🔌 Flexible runtime modes: Inline, external, CDN, or custom
- 🛠️ Build tool plugins for Vite, Webpack, Rollup, esbuild
- 🌐 Browser-ready: Works without any build step
- 📝 TypeScript support with auto-generated declarations
---
📚 Documentation & Examples
Live Documentation Website →
For practical learning, check out the examples/ directory in this repository. It contains ready-to-run projects for:
- 📜 Scripts (examples/scripts/) - Basic language features
- ⚛️ React (examples/react-todo-app/) - Full web application
- ⚡ Vite/Webpack integration demos
---
📖 Documentation & Guidelines
$3
JPS supports core Python syntax tailored for the JavaScript ecosystem.
| Feature | JPS Syntax | Compiles to JS |
|---------|------------|----------------|
| Function | def foo(a): return a | function foo(a) { return a; } |
| Class | class User: ... | class User { ... } |
| Loop | for i in range(5): ... | for (let i = 0; i < 5; i++) ... |
| List Comp | [x2 for x in nums] | nums.map(x => x 2) |
$3
Built-in Python-like functions available globally:
- print(args)
- len(obj)
- range(start, stop, step)
- sum(iterable)
- min() / max()
- sorted(iterable)
$3
`bash
Initialize a new JPS project
jps init my-project
cd my-project
Run a JPS file directly
jps run main.jps
Build for production
jps build main.jps --format esm
`
$3
Vite Plugin
`javascript
// vite.config.js
import { jpsPlugin } from 'vite-plugin-jpsx';
export default {
plugins: [jpsPlugin()]
};
`
Webpack Loader
`javascript
// webpack.config.js
module.exports = {
module: {
rules: [
{ test: /\.jps$/, use: 'jpsx-loader' }
]
}
};
``