Skip to main content

Minimal, modern embedded V8 for Python.

Project description

https://img.shields.io/pypi/v/py_mini_racer.svg

Minimal, modern embedded V8 for Python.

  • Free software: ISC license

https://github.com/sqreen/PyMiniRacer/raw/master/data/py_mini_racer.png

Features

  • Unicode support

  • Thread safe

  • Re-usable contexts

  • Binary object is Python agnostic

MiniRacer can be easily used by Django or Flask projects to minify assets, run babel or compile CoffeeScript.

Examples

py_mini_racer is straightforward to use:

>>> from py_mini_racer import py_mini_racer
>>> ctx = py_mini_racer.MiniRacer()
>>> 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}

Variables are kept inside of a context:

>>> ctx.eval("x.company")
u'Sqreen'
[1,2,3].map(n => n + 1);

Compatibility

PyMiniRacer is only compatible with Python 2.7 at the moment. Python 3 support is on its way.

Binary builds availability

The PyMiniRacer binary builds have been tested on x86_64 with:

  • OSX 10.11

  • Ubuntu >= 14.04

  • Debian >= 8

  • CentOS >= 7

You need pip >= 8.1 to install the wheels - you can check and upgrade yours in this way:

$ pip --version
$ pip install --upgrade pip

It should work on any Linux with a libc >= 2.17 and a wheel compatible pip (>= 8.1).

If you have a up-to-date pip and it doesn’t use a wheel, you might have an environment for which no wheel is built. Please open an issue.

Installation

We built Python wheels (prebuilt binaries) for OSX 64 bits and Linux 64 bits - most recent distributions. You need pip >= 1.4 and setuptools >= 0.8.

$ pip install py-mini-racer

Build

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 builds v8.

You can generate a wheel with the command:

$ python setup.py bdist_wheel

which builds v8, the extension, and generates a wheel.

Tests

If you want to run the tests, you need to build V8 first, then launch:

$ python setup.py test --addopts tests

Credits

Built with love by Sqreen.

PyMiniRacer launch was described in this blog post.

PyMiniRacer is inspired by mini_racer, built for the Ruby world by Sam Saffron.

Tools used in rendering this package:

Todo

Lower libc version needed. Export V8 version. Fix circular structures export.

History

UNRELEASED

0.1.7 (2016-10-04)

  • Improve general performances of the JS execution.

  • Add the possibility to build a different version of V8 (for example with debug symbols).

  • Fix a conflict that could happens between statically linked libraries and dynamic ones.

0.1.6 (2016-08-12)

  • Add error message when py_mini_racer sdist fails to build asking to update pip in order to download the pre-compiled wheel instead of the source distribution.

0.1.5 (2016-08-04)

  • Build py_mini_racer against a static Python. When built against a shared library python, it doesn’t work with a static Python.

0.1.4 (2016-08-04)

  • Ensure JSEvalException message is converted to unicode

0.1.3 (2016-08-04)

  • Fix extension loading for python3

  • Add a make target for building distributions (sdist + wheels)

  • Fix eval conversion for python 3

0.1.2 (2016-08-03)

  • Fix date support

  • Fix Dockerfile for generating python3 wheels

0.1.1 (2016-08-02)

  • Fix sdist distribution.

0.1.0 (2016-08-01)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_mini_racer-0.1.7.tar.gz (325.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

py_mini_racer-0.1.7-cp36-cp36m-manylinux1_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.6m

py_mini_racer-0.1.7-cp36-cp36m-macosx_10_11_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.6mmacOS 10.11+ x86-64

py_mini_racer-0.1.7-cp35-cp35m-manylinux1_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.5m

py_mini_racer-0.1.7-cp35-cp35m-macosx_10_11_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.5mmacOS 10.11+ x86-64

py_mini_racer-0.1.7-cp34-cp34m-manylinux1_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.4m

py_mini_racer-0.1.7-cp34-cp34m-macosx_10_11_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.4mmacOS 10.11+ x86-64

py_mini_racer-0.1.7-cp27-cp27mu-manylinux1_x86_64.whl (4.6 MB view details)

Uploaded CPython 2.7mu

py_mini_racer-0.1.7-cp27-cp27m-manylinux1_x86_64.whl (4.6 MB view details)

Uploaded CPython 2.7m

py_mini_racer-0.1.7-cp27-cp27m-macosx_10_11_x86_64.whl (3.9 MB view details)

Uploaded CPython 2.7mmacOS 10.11+ x86-64

py_mini_racer-0.1.7-cp27-cp27m-macosx_10_6_intel.whl (4.1 MB view details)

Uploaded CPython 2.7mmacOS 10.6+ Intel (x86-64, i386)

File details

Details for the file py_mini_racer-0.1.7.tar.gz.

File metadata

  • Download URL: py_mini_racer-0.1.7.tar.gz
  • Upload date:
  • Size: 325.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for py_mini_racer-0.1.7.tar.gz
Algorithm Hash digest
SHA256 40db866b3227861566ebbabdad2c2119fdee962730df08a1fb0e8bac96953c37
MD5 1753ad1c7229f8ab892ea8cc3fbb8dee
BLAKE2b-256 9306702588311c16d22eb985873f586ae20e30eb1cd23272ab202f8c90743320

See more details on using hashes here.

File details

Details for the file py_mini_racer-0.1.7-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for py_mini_racer-0.1.7-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 08a01f37f05bc0555427969b64d3b40545e4e975b4129a2ded95e135116dfc69
MD5 2a8599c6f3933572ac12fc44e3480fe3
BLAKE2b-256 2e525a4061236c54b1f0e0511b59b652a0d9102a5cc0e2512e149fbd15e685b8

See more details on using hashes here.

File details

Details for the file py_mini_racer-0.1.7-cp36-cp36m-macosx_10_11_x86_64.whl.

File metadata

File hashes

Hashes for py_mini_racer-0.1.7-cp36-cp36m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 8d92ad640983d5c8fe3b46bdf686d7124ab37cb1d34454f491eb7afa09d41d03
MD5 adda0135c855fd56b32882602184776b
BLAKE2b-256 3b6bfcbd1b5b2d94361b5b9bcf3964395e2b8f1984b52c5ed268bca876092ea7

See more details on using hashes here.

File details

Details for the file py_mini_racer-0.1.7-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for py_mini_racer-0.1.7-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4f43dc84c2b5b9d026b72848aa7e7d3a44cd04e49900fa800d49cef491414119
MD5 d2a11b66cd79a6d10eacdd3c08c163b9
BLAKE2b-256 9ddbab6f5be651c68ed21febf70e6bfe8b7347ac7a7dafa7e1698a939ec375ac

See more details on using hashes here.

File details

Details for the file py_mini_racer-0.1.7-cp35-cp35m-macosx_10_11_x86_64.whl.

File metadata

File hashes

Hashes for py_mini_racer-0.1.7-cp35-cp35m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 ced809511245321a91c6669362dc2d8632434e649b33acd57ecb53ed771c2493
MD5 3e399688dbc8cadc0498cef1e3b7b81e
BLAKE2b-256 cff2c78bd147e7ae552df978590c92cf86c9d6747f47160b46f253ca5aa72e8a

See more details on using hashes here.

File details

Details for the file py_mini_racer-0.1.7-cp34-cp34m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for py_mini_racer-0.1.7-cp34-cp34m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 38ec951e5d47f576bf539b25ee29e142640e32e496332a129595cc296b27e043
MD5 e4266786f60e0bb8d7d8de18ac28c756
BLAKE2b-256 1173d6c8c53dd60c88d284e48a4b344fe708877eda3ecad89ffe58be2a6039f2

See more details on using hashes here.

File details

Details for the file py_mini_racer-0.1.7-cp34-cp34m-macosx_10_11_x86_64.whl.

File metadata

File hashes

Hashes for py_mini_racer-0.1.7-cp34-cp34m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 18a5c8ebe3038a376ff83208f9ce52b284723b67a6840850c583ec81194c3cd5
MD5 499e1b0123f6895778dd308edc263a1d
BLAKE2b-256 c2c7a78ad270eebe9d6bab326034a8a1f73f450b9c1b59fe84054fff3326862c

See more details on using hashes here.

File details

Details for the file py_mini_racer-0.1.7-cp27-cp27mu-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for py_mini_racer-0.1.7-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9146c19e1438c539af00091b8e27357602a9cc31759acd01e9dc190e41faeaec
MD5 eecaf599282e1bb817675bbc9cd71e20
BLAKE2b-256 a2ef518ce0aba096f91fed6bf7cc0b4e56f4670f68f3bd5a59657e7507282365

See more details on using hashes here.

File details

Details for the file py_mini_racer-0.1.7-cp27-cp27m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for py_mini_racer-0.1.7-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6e68fd0021aa2db3469c84f39fecd353aef77082ab8dd24bf823da76076a457f
MD5 f886d98b544019db8e6c5a83c6c66966
BLAKE2b-256 16b5d2ec21d696d626b8fac46c392b0be178c84240796b7b60fef07f11078867

See more details on using hashes here.

File details

Details for the file py_mini_racer-0.1.7-cp27-cp27m-macosx_10_11_x86_64.whl.

File metadata

File hashes

Hashes for py_mini_racer-0.1.7-cp27-cp27m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 7f8ccc773446b8ab7417da47309ce2b801eaf67d3ce455d9cd4de82222e44db1
MD5 61514c8a7018c86ce27058aadccd05f8
BLAKE2b-256 1b0c283c736387229acc3de0a110b9d18859d0cb777909f27d296427e7fb2ba5

See more details on using hashes here.

File details

Details for the file py_mini_racer-0.1.7-cp27-cp27m-macosx_10_6_intel.whl.

File metadata

File hashes

Hashes for py_mini_racer-0.1.7-cp27-cp27m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 18b3d0ab48b36844f1c62caf439969a4f4630cc3d39b781d2886b0af66ad7150
MD5 c47e73aca8439f7954d663a1206b248a
BLAKE2b-256 dc867f85f8910bd7d771b2c3176332faeb86f06c662cd9c59a0ff40272d99212

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page