PyExecJS


NamePyExecJS JSON
Version 1.5.1 PyPI version JSON
download
home_pagehttps://github.com/doloopwhile/PyExecJS
SummaryRun JavaScript code from Python
upload_time2018-01-18 04:33:55
maintainer
docs_urlNone
authorOmoto Kenji
requires_python
licenseMIT License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            PyExecJS (EOL)
==============

End of life
===========

This library is no longer maintananced. Bugs are not be fixed (even if
they are trivial or essential).

We suggest to use other library or to make a fork.

--------------

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.

A short example:

::

    >>> import execjs
    >>> 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

Supported runtimes
==================

First-class support (runtime class is provided and tested)
----------------------------------------------------------

-  `PyV8 <http://code.google.com/p/pyv8/>`__ - A python wrapper for
   Google V8 engine,
-  `Node.js <http://nodejs.org/>`__
-  `PhantomJS <http://phantomjs.org/>`__
-  `Nashorn <http://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/intro.html#sthref16>`__
   - Included with Oracle Java 8

Second-class support (runtime class is privided but not tested)
---------------------------------------------------------------

-  Apple JavaScriptCore - Included with Mac OS X
-  `Microsoft Windows Script
   Host <http://msdn.microsoft.com/en-us/library/9bbdkx3k.aspx>`__
   (JScript)
-  `SlimerJS <http://slimerjs.org/>`__
-  `Mozilla SpiderMonkey <http://www.mozilla.org/js/spidermonkey/>`__

Installation
============

::

    $ pip install PyExecJS

or

::

    $ easy_install PyExecJS

Details
=======

If ``EXECJS_RUNTIME`` environment variable is specified, PyExecJS pick
the JavaScript runtime as a default:

::

    >>> execjs.get().name # this value is depends on your environment.
    >>> os.environ["EXECJS_RUNTIME"] = "Node"
    >>> execjs.get().name
    'Node.js (V8)'

You can choose JavaScript runtime by ``execjs.get()``:

::

    >>> default = execjs.get() # the automatically picked runtime
    >>> default.eval("1 + 2")
    3
    >>> import execjs.runtime_names
    >>> jscript = execjs.get(execjs.runtime_names.JScript)
    >>> jscript.eval("1 + 2")
    3
    >>> import execjs.runtime_names
    >>> node = execjs.get(execjs.runtime_names.Node)
    >>> node.eval("1 + 2")
    3

The pros of PyExecJS is that you do not need take care of JavaScript
environment. Especially, it works in Windows environment without
installing extra libraries.

One of cons of PyExecJS is performance. PyExecJS communicate JavaScript
runtime by text and it is slow. The other cons is that it does not fully
support runtime specific features.

`PyV8 <https://code.google.com/p/pyv8/>`__ might be better choice for
some use case.

License
=======

Copyright (c) 2016 Omoto Kenji. Copyright (c) 2011 Sam Stephenson and
Josh Peek. (As a author of ExecJS)

Released under the MIT license. See ``LICENSE`` for details.

Changelog
=========

1.5.0
-----

-  Eased version requirement for six.

1.4.1
-----

-  Fixed arguments of module-level functions.
-  Fixed bug of execution with pipe.
-  Fixed wrong excption is raised.

1.4.0
-----

-  Fixed required libraries.
-  Fixed order of output of ``--print-available-runtimes``.
-  Execute some JavaScript runtime with pipe/stdin (without temporary
   file).

1.3.1
-----

-  Fixed ``--print-available-runtimes`` fails in Python 2.7.

1.3.0
-----

-  Added ``cwd`` argument.

1.2.0
-----

-  Supported Python 3.5
-  Supported Nashorn(Java 8 JavaScript engine) as runtime
-  Dropped support for Python 2.6 and 3.2

1.1.0
-----

-  Supported Python 3.4
-  Supported SlimerJS as runtime
-  Supported PhantomJS as runtime
-  Fixed JScript runtime on Windows 8

1.0.5
-----

-  Supported Python 3.3
-  Fixed file handle leaking
-  Fixed issue with passenger-nginx-4.0

1.0.4
-----

-  Removed "import execjs" (it prevent execution of setup.py by Python
   2.6)

1.0.3
-----

-  Javascript sources were embeded in **init**.py. 'which' command were
   reimplemented by pure python.

1.0.2
-----

-  Python 2.6.x was supported.

1.0.1
-----

-  Forgotten shell=True was added to Popen.

1.0.0
-----

-  First release.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/doloopwhile/PyExecJS",
    "name": "PyExecJS",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Omoto Kenji",
    "author_email": "doloopwhile@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ba/8e/aedef81641c8dca6fd0fb7294de5bed9c45f3397d67fddf755c1042c2642/PyExecJS-1.5.1.tar.gz",
    "platform": "",
    "description": "PyExecJS (EOL)\n==============\n\nEnd of life\n===========\n\nThis library is no longer maintananced. Bugs are not be fixed (even if\nthey are trivial or essential).\n\nWe suggest to use other library or to make a fork.\n\n--------------\n\nRun JavaScript code from Python.\n\nPyExecJS is a porting of ExecJS from Ruby. PyExecJS **automatically**\npicks the best runtime available to evaluate your JavaScript program.\n\nA short example:\n\n::\n\n    >>> import execjs\n    >>> execjs.eval(\"'red yellow blue'.split(' ')\")\n    ['red', 'yellow', 'blue']\n    >>> ctx = execjs.compile(\"\"\"\n    ...     function add(x, y) {\n    ...         return x + y;\n    ...     }\n    ... \"\"\")\n    >>> ctx.call(\"add\", 1, 2)\n    3\n\nSupported runtimes\n==================\n\nFirst-class support (runtime class is provided and tested)\n----------------------------------------------------------\n\n-  `PyV8 <http://code.google.com/p/pyv8/>`__ - A python wrapper for\n   Google V8 engine,\n-  `Node.js <http://nodejs.org/>`__\n-  `PhantomJS <http://phantomjs.org/>`__\n-  `Nashorn <http://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/intro.html#sthref16>`__\n   - Included with Oracle Java 8\n\nSecond-class support (runtime class is privided but not tested)\n---------------------------------------------------------------\n\n-  Apple JavaScriptCore - Included with Mac OS X\n-  `Microsoft Windows Script\n   Host <http://msdn.microsoft.com/en-us/library/9bbdkx3k.aspx>`__\n   (JScript)\n-  `SlimerJS <http://slimerjs.org/>`__\n-  `Mozilla SpiderMonkey <http://www.mozilla.org/js/spidermonkey/>`__\n\nInstallation\n============\n\n::\n\n    $ pip install PyExecJS\n\nor\n\n::\n\n    $ easy_install PyExecJS\n\nDetails\n=======\n\nIf ``EXECJS_RUNTIME`` environment variable is specified, PyExecJS pick\nthe JavaScript runtime as a default:\n\n::\n\n    >>> execjs.get().name # this value is depends on your environment.\n    >>> os.environ[\"EXECJS_RUNTIME\"] = \"Node\"\n    >>> execjs.get().name\n    'Node.js (V8)'\n\nYou can choose JavaScript runtime by ``execjs.get()``:\n\n::\n\n    >>> default = execjs.get() # the automatically picked runtime\n    >>> default.eval(\"1 + 2\")\n    3\n    >>> import execjs.runtime_names\n    >>> jscript = execjs.get(execjs.runtime_names.JScript)\n    >>> jscript.eval(\"1 + 2\")\n    3\n    >>> import execjs.runtime_names\n    >>> node = execjs.get(execjs.runtime_names.Node)\n    >>> node.eval(\"1 + 2\")\n    3\n\nThe pros of PyExecJS is that you do not need take care of JavaScript\nenvironment. Especially, it works in Windows environment without\ninstalling extra libraries.\n\nOne of cons of PyExecJS is performance. PyExecJS communicate JavaScript\nruntime by text and it is slow. The other cons is that it does not fully\nsupport runtime specific features.\n\n`PyV8 <https://code.google.com/p/pyv8/>`__ might be better choice for\nsome use case.\n\nLicense\n=======\n\nCopyright (c) 2016 Omoto Kenji. Copyright (c) 2011 Sam Stephenson and\nJosh Peek. (As a author of ExecJS)\n\nReleased under the MIT license. See ``LICENSE`` for details.\n\nChangelog\n=========\n\n1.5.0\n-----\n\n-  Eased version requirement for six.\n\n1.4.1\n-----\n\n-  Fixed arguments of module-level functions.\n-  Fixed bug of execution with pipe.\n-  Fixed wrong excption is raised.\n\n1.4.0\n-----\n\n-  Fixed required libraries.\n-  Fixed order of output of ``--print-available-runtimes``.\n-  Execute some JavaScript runtime with pipe/stdin (without temporary\n   file).\n\n1.3.1\n-----\n\n-  Fixed ``--print-available-runtimes`` fails in Python 2.7.\n\n1.3.0\n-----\n\n-  Added ``cwd`` argument.\n\n1.2.0\n-----\n\n-  Supported Python 3.5\n-  Supported Nashorn(Java 8 JavaScript engine) as runtime\n-  Dropped support for Python 2.6 and 3.2\n\n1.1.0\n-----\n\n-  Supported Python 3.4\n-  Supported SlimerJS as runtime\n-  Supported PhantomJS as runtime\n-  Fixed JScript runtime on Windows 8\n\n1.0.5\n-----\n\n-  Supported Python 3.3\n-  Fixed file handle leaking\n-  Fixed issue with passenger-nginx-4.0\n\n1.0.4\n-----\n\n-  Removed \"import execjs\" (it prevent execution of setup.py by Python\n   2.6)\n\n1.0.3\n-----\n\n-  Javascript sources were embeded in **init**.py. 'which' command were\n   reimplemented by pure python.\n\n1.0.2\n-----\n\n-  Python 2.6.x was supported.\n\n1.0.1\n-----\n\n-  Forgotten shell=True was added to Popen.\n\n1.0.0\n-----\n\n-  First release.\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Run JavaScript code from Python",
    "version": "1.5.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "f530b8e14373714448a94f458d24d1d6",
                "sha256": "34cc1d070976918183ff7bdc0ad71f8157a891c92708c00c5fbbff7a769f505c"
            },
            "downloads": -1,
            "filename": "PyExecJS-1.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f530b8e14373714448a94f458d24d1d6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 13344,
            "upload_time": "2018-01-18T04:33:55",
            "upload_time_iso_8601": "2018-01-18T04:33:55.126031Z",
            "url": "https://files.pythonhosted.org/packages/ba/8e/aedef81641c8dca6fd0fb7294de5bed9c45f3397d67fddf755c1042c2642/PyExecJS-1.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2018-01-18 04:33:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "doloopwhile",
    "github_project": "PyExecJS",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pyexecjs"
}
        
Elapsed time: 0.01783s