Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
PyExecJS.egg-info/ | H | 03-May-2022 | - | 222 | 160 | |
execjs/ | H | 03-May-2022 | - | 865 | 679 | |
LICENSE | H A D | 16-Mar-2016 | 1.1 KiB | 23 | 19 | |
MANIFEST.in | H A D | 16-Mar-2016 | 56 | 3 | 3 | |
PKG-INFO | H A D | 18-Jan-2018 | 6.5 KiB | 222 | 160 | |
README.md | H A D | 18-Jan-2018 | 3.9 KiB | 144 | 101 | |
README.rst | H A D | 18-Jan-2018 | 4.1 KiB | 199 | 138 | |
setup.cfg | H A D | 18-Jan-2018 | 38 | 5 | 3 | |
setup.py | H A D | 18-Jan-2018 | 1.3 KiB | 45 | 38 | |
test_execjs.py | H A D | 31-Oct-2017 | 5.2 KiB | 142 | 113 |
README.md
1PyExecJS (EOL) 2============== 3[![Build Status](https://travis-ci.org/doloopwhile/PyExecJS.svg?branch=travis-ci)](https://travis-ci.org/doloopwhile/PyExecJS) 4 5# End of life 6 7This library is no longer maintananced. Bugs are not be fixed (even if they are trivial or essential). 8 9We suggest to use other library or to make a fork. 10 11--- 12 13Run JavaScript code from Python. 14 15PyExecJS is a porting of ExecJS from Ruby. 16PyExecJS **automatically** picks the best runtime available to evaluate your JavaScript program. 17 18A short example: 19 20 >>> import execjs 21 >>> execjs.eval("'red yellow blue'.split(' ')") 22 ['red', 'yellow', 'blue'] 23 >>> ctx = execjs.compile(""" 24 ... function add(x, y) { 25 ... return x + y; 26 ... } 27 ... """) 28 >>> ctx.call("add", 1, 2) 29 3 30 31# Supported runtimes 32 33## First-class support (runtime class is provided and tested) 34 35* [PyV8](http://code.google.com/p/pyv8/) - A python wrapper for Google V8 engine, 36* [Node.js](http://nodejs.org/) 37* [PhantomJS](http://phantomjs.org/) 38* [Nashorn](http://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/intro.html#sthref16) - Included with Oracle Java 8 39 40## Second-class support (runtime class is privided but not tested) 41 42* Apple JavaScriptCore - Included with Mac OS X 43* [Microsoft Windows Script Host](http://msdn.microsoft.com/en-us/library/9bbdkx3k.aspx) (JScript) 44* [SlimerJS](http://slimerjs.org/) 45* [Mozilla SpiderMonkey](http://www.mozilla.org/js/spidermonkey/) 46 47# Installation 48 49 $ pip install PyExecJS 50 51or 52 53 $ easy_install PyExecJS 54 55# Details 56 57If `EXECJS_RUNTIME` environment variable is specified, PyExecJS pick the JavaScript runtime as a default: 58 59 >>> execjs.get().name # this value is depends on your environment. 60 >>> os.environ["EXECJS_RUNTIME"] = "Node" 61 >>> execjs.get().name 62 'Node.js (V8)' 63 64You can choose JavaScript runtime by `execjs.get()`: 65 66 >>> default = execjs.get() # the automatically picked runtime 67 >>> default.eval("1 + 2") 68 3 69 >>> import execjs.runtime_names 70 >>> jscript = execjs.get(execjs.runtime_names.JScript) 71 >>> jscript.eval("1 + 2") 72 3 73 >>> import execjs.runtime_names 74 >>> node = execjs.get(execjs.runtime_names.Node) 75 >>> node.eval("1 + 2") 76 3 77 78The pros of PyExecJS is that you do not need take care of JavaScript environment. 79Especially, it works in Windows environment without installing extra libraries. 80 81One of cons of PyExecJS is performance. PyExecJS communicate JavaScript runtime by text and it is slow. 82The other cons is that it does not fully support runtime specific features. 83 84[PyV8](https://code.google.com/p/pyv8/) might be better choice for some use case. 85 86# License 87 88Copyright (c) 2016 Omoto Kenji. 89Copyright (c) 2011 Sam Stephenson and Josh Peek. (As a author of ExecJS) 90 91Released under the MIT license. See `LICENSE` for details. 92 93# Changelog 94 95## 1.5.0 96- Eased version requirement for six. 97 98## 1.4.1 99- Fixed arguments of module-level functions. 100- Fixed bug of execution with pipe. 101- Fixed wrong excption is raised. 102 103## 1.4.0 104- Fixed required libraries. 105- Fixed order of output of `--print-available-runtimes`. 106- Execute some JavaScript runtime with pipe/stdin (without temporary file). 107 108## 1.3.1 109- Fixed `--print-available-runtimes` fails in Python 2.7. 110 111## 1.3.0 112- Added `cwd` argument. 113 114## 1.2.0 115- Supported Python 3.5 116- Supported Nashorn(Java 8 JavaScript engine) as runtime 117- Dropped support for Python 2.6 and 3.2 118 119## 1.1.0 120- Supported Python 3.4 121- Supported SlimerJS as runtime 122- Supported PhantomJS as runtime 123- Fixed JScript runtime on Windows 8 124 125## 1.0.5 126- Supported Python 3.3 127- Fixed file handle leaking 128- Fixed issue with passenger-nginx-4.0 129 130## 1.0.4 131- Removed "import execjs" (it prevent execution of setup.py by Python 2.6) 132 133## 1.0.3 134- Javascript sources were embeded in __init__.py. 'which' command were reimplemented by pure python. 135 136## 1.0.2 137- Python 2.6.x was supported. 138 139## 1.0.1 140- Forgotten shell=True was added to Popen. 141 142## 1.0.0 143- First release. 144
README.rst
1PyExecJS (EOL) 2============== 3 4End of life 5=========== 6 7This library is no longer maintananced. Bugs are not be fixed (even if 8they are trivial or essential). 9 10We suggest to use other library or to make a fork. 11 12-------------- 13 14Run JavaScript code from Python. 15 16PyExecJS is a porting of ExecJS from Ruby. PyExecJS **automatically** 17picks the best runtime available to evaluate your JavaScript program. 18 19A short example: 20 21:: 22 23 >>> import execjs 24 >>> execjs.eval("'red yellow blue'.split(' ')") 25 ['red', 'yellow', 'blue'] 26 >>> ctx = execjs.compile(""" 27 ... function add(x, y) { 28 ... return x + y; 29 ... } 30 ... """) 31 >>> ctx.call("add", 1, 2) 32 3 33 34Supported runtimes 35================== 36 37First-class support (runtime class is provided and tested) 38---------------------------------------------------------- 39 40- `PyV8 <http://code.google.com/p/pyv8/>`__ - A python wrapper for 41 Google V8 engine, 42- `Node.js <http://nodejs.org/>`__ 43- `PhantomJS <http://phantomjs.org/>`__ 44- `Nashorn <http://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/intro.html#sthref16>`__ 45 - Included with Oracle Java 8 46 47Second-class support (runtime class is privided but not tested) 48--------------------------------------------------------------- 49 50- Apple JavaScriptCore - Included with Mac OS X 51- `Microsoft Windows Script 52 Host <http://msdn.microsoft.com/en-us/library/9bbdkx3k.aspx>`__ 53 (JScript) 54- `SlimerJS <http://slimerjs.org/>`__ 55- `Mozilla SpiderMonkey <http://www.mozilla.org/js/spidermonkey/>`__ 56 57Installation 58============ 59 60:: 61 62 $ pip install PyExecJS 63 64or 65 66:: 67 68 $ easy_install PyExecJS 69 70Details 71======= 72 73If ``EXECJS_RUNTIME`` environment variable is specified, PyExecJS pick 74the JavaScript runtime as a default: 75 76:: 77 78 >>> execjs.get().name # this value is depends on your environment. 79 >>> os.environ["EXECJS_RUNTIME"] = "Node" 80 >>> execjs.get().name 81 'Node.js (V8)' 82 83You can choose JavaScript runtime by ``execjs.get()``: 84 85:: 86 87 >>> default = execjs.get() # the automatically picked runtime 88 >>> default.eval("1 + 2") 89 3 90 >>> import execjs.runtime_names 91 >>> jscript = execjs.get(execjs.runtime_names.JScript) 92 >>> jscript.eval("1 + 2") 93 3 94 >>> import execjs.runtime_names 95 >>> node = execjs.get(execjs.runtime_names.Node) 96 >>> node.eval("1 + 2") 97 3 98 99The pros of PyExecJS is that you do not need take care of JavaScript 100environment. Especially, it works in Windows environment without 101installing extra libraries. 102 103One of cons of PyExecJS is performance. PyExecJS communicate JavaScript 104runtime by text and it is slow. The other cons is that it does not fully 105support runtime specific features. 106 107`PyV8 <https://code.google.com/p/pyv8/>`__ might be better choice for 108some use case. 109 110License 111======= 112 113Copyright (c) 2016 Omoto Kenji. Copyright (c) 2011 Sam Stephenson and 114Josh Peek. (As a author of ExecJS) 115 116Released under the MIT license. See ``LICENSE`` for details. 117 118Changelog 119========= 120 1211.5.0 122----- 123 124- Eased version requirement for six. 125 1261.4.1 127----- 128 129- Fixed arguments of module-level functions. 130- Fixed bug of execution with pipe. 131- Fixed wrong excption is raised. 132 1331.4.0 134----- 135 136- Fixed required libraries. 137- Fixed order of output of ``--print-available-runtimes``. 138- Execute some JavaScript runtime with pipe/stdin (without temporary 139 file). 140 1411.3.1 142----- 143 144- Fixed ``--print-available-runtimes`` fails in Python 2.7. 145 1461.3.0 147----- 148 149- Added ``cwd`` argument. 150 1511.2.0 152----- 153 154- Supported Python 3.5 155- Supported Nashorn(Java 8 JavaScript engine) as runtime 156- Dropped support for Python 2.6 and 3.2 157 1581.1.0 159----- 160 161- Supported Python 3.4 162- Supported SlimerJS as runtime 163- Supported PhantomJS as runtime 164- Fixed JScript runtime on Windows 8 165 1661.0.5 167----- 168 169- Supported Python 3.3 170- Fixed file handle leaking 171- Fixed issue with passenger-nginx-4.0 172 1731.0.4 174----- 175 176- Removed "import execjs" (it prevent execution of setup.py by Python 177 2.6) 178 1791.0.3 180----- 181 182- Javascript sources were embeded in **init**.py. 'which' command were 183 reimplemented by pure python. 184 1851.0.2 186----- 187 188- Python 2.6.x was supported. 189 1901.0.1 191----- 192 193- Forgotten shell=True was added to Popen. 194 1951.0.0 196----- 197 198- First release. 199