PyPy is not as slow as CPython, so it could be useful for number crunching.
However, PyPy doesn't really support stuff like SciPy and matplotlib,
which are also very useful in number crunching stuff. cpyproxy
is an evil hack
to use CPython stuff in PyPy code. The heavy lifting is done by RpyC.
Usage may well break bits, pieces and living organisms. Proxied calls are very expensive, so better keep them to the minimum. Using the PyPy's numpy fork is probably essential for any more complex stuff.
Everything is in public domain, except stuff in cpyproxy/fake-site
has their
own licenses, so check them out first if you're doing some evil business stuff.
$ git clone https://github.com/jampekka/cpyproxy.git
Optionally copy cpyproxy/cpyproxy
to some directory that's in PYTHONPATH
.
The simplest usage is to run your not-fully-PyPy-compliant stuff using:
$ pypy -m cpyproxy.black_magic <your_script.py>
See the examples below for different kinds of insanity.
After install, do cd cpyproxy
and try out these and pray. If you have
matplotlib installed, they should end up showing a picture. If not,
you'll get an error.
$ pypy -m cpyproxy.black_magic test_no_magic.py
$ pypy test_black_magic.py
$ pypy test_import_magic.py
$ pypy test_explicit.py