Python to JavaScript Translator
PythonJS
PythonJS is a Python to Javascript translator written in Python, created by Amirouche Boubekki and Brett Hartshorn. It converts a subset of Python into a subset of Javascript. It features: list comprehensions, classes, multiple inheritance, first-class functions, operator overloading, function and class decorators, HTML DOM, and easily integrates with JavaScript and external JavaScript libraries. The generated code works in the Browser and in NodeJS.
Get Source Code::
git clone https://github.com/PythonJS/PythonJS.git
Translate Your Script::
cd PythonJS/pythonjs
./translator.py myscript1.py myscript2.py > ~/myapp.js
The translator.py script can take in multiple Python scripts, these are appended together, and translated into a single JavaScript. The output is printed to stdout. If no command line arguments is given, then translator.py takes input from stdin.
Install Tornado for Python3::
wget https://pypi.python.org/packages/source/t/tornado/tornado-3.1.1.tar.gz
tar xvf tornado-3.1.1.tar.gz
cd tornado-3.1.1
python3 setup.py build
sudo python3 setup.py install
Run Test Server::
cd PythonJS/tests
./server.py
Then open a web browser and go to: http://localhost:8080
The test server dynamically compiles Python into JavaScript, this greatly speeds up the testing and development process. Any html file you place in the PythonJS/tests directory will become available as a new web-page. When this web-page is requested the server will parse the html and check all the