Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


pyjaco - Python to JavaScript compiler

web page:

mailing list:


There are several ways to install pyjaco. Since pyjaco is still under development we recommend to use virtualenv. Although pythons standard installation shall work fine.


git clone
virtualenv nameOfVenv
cd pyjaco
../nameOfVenv/bin/python install


git clone
cd pyjaco
python install


git clone
cd pyjaco


In general there are two ways to use pyjaco. The first is to compile a Python file to a JavaScript file and the second is to invoke the compiler into a python script.

py file to js file (with and without virtualenv): [options] <infile> -o <outfile>

pathToVenv/bin/ [options] <infile> -o <outfile>

Where <infile> is the name of a file that will be compiled. If the infile is a directory, all files in that directory that have an extension of .py or .pyjaco will be compiled to .js files into the output directory.

to generate the buildins, run: -b generate

For more parameter see the options section.

invoke the compiler into a python program:

import sys
from pyjaco import Compiler
code = open("", "r")
compiler = Compiler()
print str(compiler)


Like explained previously there are 2 ways to use pyjaco. In the pyjaco folder you can find a few examples that you can use for testing.

py file to js file: tests/algorithms/ -o fib.js


python examples/ > examples/gol.html
firefox examples/gol.html

If it doesn't work, it's a bug.


available options:

-h, --help            show this help message and exit
-o OUTPUT, --output=OUTPUT
                      write output to OUTPUT, can be a file or directory
-q, --quiet           Do not print informative notes to stderr
-b BUILTINS, --builtins=BUILTINS
                      INCLUDE builtins statically in each file
                      IMPORT builtins using a load statement in each file
                      GENERATE a separate file for builtins (output must be a directory)
                      NONE don't include builtins
-I, --import          IMPORT builtins using a load statement in each file
                      This is an alias for -b import
-w, --watch           Watch the input files for changes and recompile. If
                      the input file is a single file, watch it for changes
                      and recompile. If a directory, recompile if any .py or
                      .pyjaco files in the directory have changes.


Pyjaco brings a test facility with it. However, to run the test sets a JS console is necessary. See here:

Run all tests, that are supposed to work.


Run all tests with "foo" in the name. Useful for running a group of tests.

./ foo

Run all tests including those that are known to fail (currently). It should be understandable from the output.

./ -a

Run tests but ignore if an error is raised by the test. This is not affecting the error generated by the test files in the tests directory.

./ -x
./ --no-error

For more flags then described here, use -h option

./ -h

Single test cases

With the "casetest" script you can keep comparing the output of pyjaco to the output of python on the same python script. It's very useful if you are debugging the compiler or standard library.


Will run through python and pyjaco, and display the differences. It will then display a line of "#", and wait for you to press enter to do another iteration. When the files match, casetest will exit.


Free Software. See the LICENSE file for exact details.


Python to JavaScript translator




No packages published
You can’t perform that action at this time.