A Racket/Scheme implementation using RPython. It adds a JIT.
In order to do anything with Pycket, you need to check out PyPy:
$ hg clone https://bitbucket.org/pypy/pypy
The below instructions assume that you do this checkout in this directory.
Additionally, it helps to have the build dependencies of PyPy installed. On a Debian or Ubuntu system:
$ sudo apt-get build-dep pypy
You also need a reasonably recent version of Racket, at least version
6.1.1. Then you need to set up the
pycket language in Racket:
$ raco pkg install -t dir pycket/pycket-lang/
Afterwards you can run the unit-tests as follows:
$ pypy/pytest.py pycket
$ make test
To produce an executable, run:
$ ./pypy/rpython/bin/rpython -Ojit targetpycket.py
This expects that a binary named
pypy is in your path. (Note that
a hand-compiled PyPy by running
If you don't have a compiled pypy, you can also translate with:
$ python ./pypy/rpython/bin/rpython -Ojit targetpycket.py
This will take upwards of 10 minutes.
This requires a
PYTHONPATH that includes both
rpython (that should
pypy directory cloned above) and
pycket (that should be
You can also use
make for any of the above,
make setupto setup the Racket language and update your
make pycket-cto translate with JIT
make pycket-c-nojitto translate without JIT (which is may be a lot faster to translate but runs a lot lot slower)
Afterwards you can execute a program:
$ ./pycket-c program
You can also run pycket under plain python, like this:
$ ./pycket-slow.sh program
Or even this, when this directory is in your
$ python -mpycket program
You can edit the shell script to make it use pypy, if desired.
You can generate a coverage report with
$ pypy/pytest.py --cov .
$ make coverage
which also generates an HTML report in
You need these Python packages for that to work:
pytest-cov(provided with the
Makefile reacts to some variables:
PYPYPATHfor when your
pypycheckout is not in this directory.
PYTESTfor when you don’t want to use
pypy’s version of pytest.
RPYTHONfor when you want to use something other than the default
rpythonscript, but you probablywould not want that.
Pycket's benchmarks are available at this repository, along with instructions for running them.