Run JavaScript code from Python
Project description
Run JavaScript code from Python.
PyExecJS is a porting of ExecJS from Ruby. PyExecJS automatically picks the best runtime available to evaluate your JavaScript program, then returns the result to you as a Python object.
A short example:
>>> execjs.eval("'red yellow blue'.split(' ')")
['red', 'yellow', 'blue']
>>> ctx = execjs.compile("""
... function add(x, y) {
... return x + y;
... }
... """)
>>> ctx.call("add", 1, 2)
3
PyExecJS supports these runtimes:
[PyV8](http://code.google.com/p/pyv8/) - A python wrapper for Google V8 engine,
[Node.js](http://nodejs.org/)
Apple JavaScriptCore - Included with Mac OS X
[Mozilla SpiderMonkey](http://www.mozilla.org/js/spidermonkey/)
[Microsoft Windows Script Host](http://msdn.microsoft.com/en-us/library/9bbdkx3k.aspx) (JScript)
# Installation
$ pip install execjs
or
$ easy_install execjs
# License
Copyright (c) 2011 Omoto Kenji. Copyright (c) 2011 Sam Stephenson and Josh Peek.
Released under the MIT license. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file PyExecJS-1.0.0.zip.
File metadata
- Download URL: PyExecJS-1.0.0.zip
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a898a142e1cd9e5c97b909caf287f3c3c790d2b7447034b8eb02b6c2d80783e
|
|
| MD5 |
0d7c6cf5c6fbc7319ef929660e01dc3e
|
|
| BLAKE2b-256 |
821b968b5e3878fa00a80550d1a17474c94e22ea02ea4d7afbf8ad11746f30aa
|