Automatically cross compiles .py files to .so (or .pyd) using Cython and import hooks.

How to use:

import pythonjit

And imports will automatically be cythonized.

For more performance benefits, use the decorators provided by cython to statically type variables and return types. The relevant decorators are:

Types are also part of the cython module:

For more information on cython types and decorators, see the cython docs

Bugs in your code and compilation time

Cython is more stringent than the python interpreter when it comes to catching errors in code. E.g. It will complain about NameErrors that occur in unreachable code, which the python interpreter will not do. A larger/complex project may have issues to fix before Cython can compile it.

Cross compilation can take some time, especially for larger projects. A caching mechanism is used to compensate for this, so the first run will be slower than future runs.


Notes/Known issues/Complications:

Read the Docs

More documentation can be found on readthedocs