Ninia is currently a work-in-progress, and actively welcomes contributions!
Supports a subset of Python 2.7.8 bytecode:
- Functions (including keyword and default arguments)
- Condition statements (
ifand comparisons of integers and booleans)
- The four numeric types: Integer (32 and 64 bit), Long (arbitrary precision), Float, and Complex.
- Certain operations are unsupported, e.g. powers for complex numbers
- NOTE: This interpreter forces true division. That is,
5 / 2 == 2.5. To force floor division, use the
//operator à la Python 3.
- Opcode status: 65 of 119 defined and (mostly) working.
Building & Running
- node.js, npm, and bower
- Python 2.7 for compiling tests (
python2.7should be in $PATH)
browser/demo.html in your browser of choice.
Click on "Choose File" and upload a .pyc file, then click "Process File". The output should appear in the Output area.
To create a .pyc file from a .py file, simply run:
python -m compileall file.py
Run the test suite with
Alternatively, follow the "Running" steps and load one of the
*test.pyc files from the pytests/ directory.
Adding More Tests
- Write a python file
testExample.pysomewhere in the pytests/ directory.
- Add a new line to test.ts that gives a description for the test and a path to the test file:
["This is a sample test", "pytests/path/to/testExample"],
- Check that it runs with
Ninia will reuse the common infrastructure present in Doppio and DoppioJVM to bring Python to the browser.