Minimal, modern embedded V8 for Python.
- Free software: ISC license
- Documentation: https://py_mini_racer.readthedocs.org.
- Unicode support
- Thread safe
- Re-usable contexts
- Binary object is Python agnostic
py_mini_racer is straightforward to use:
>>> from py_mini_racer import py_mini_racer
>>> ctx = py_mini_racer.Context()
>>> ctx.eval('1+1')
2
>>> ctx.eval("var x = {company: 'Sqreen'}; x.company")
u'Sqreen'
>>> print ctx.eval(u"'\N{HEAVY BLACK HEART}'")
❤
>>> ctx.eval("var fun = () => ({ foo: 1 });")
>>> ctx.call("fun")
{u'foo': 1}
We built Python wheels (prebuilt binaries) for OSX 64 bits and Linux 32 & 64 bits. You need pip >= 1.4 and setuptools >= 0.8.
$ pip install pyminiracer
You can build v8 with the command:
$ python setup.py build_v8
You can also build the ctype extension:
$ python setup.py build_ext
Which automatically build v8.
You can generate a wheel with the command:
$ python setup.py bdist_wheel
which builds v8, the extension, and generates a wheel.
If you want to run the tests, you need to build V8 first, then launch:
$ python setup.py test --addopts tests
PyMiniRacer is inspired by mini_racer, built for the Ruby world by Sam Saffron.
Tools used in rendering this package: