Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pyjs/pyjs
Pyjs canonical sources. Start here!
https://github.com/pyjs/pyjs
Last synced: 13 days ago
JSON representation
Pyjs canonical sources. Start here!
- Host: GitHub
- URL: https://github.com/pyjs/pyjs
- Owner: pyjs
- License: apache-2.0
- Created: 2012-04-08T09:00:40.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2021-08-03T20:11:45.000Z (over 3 years ago)
- Last Synced: 2024-08-01T22:57:30.797Z (3 months ago)
- Language: Python
- Homepage: http://pyjs.org/
- Size: 16.9 MB
- Stars: 1,138
- Watchers: 84
- Forks: 214
- Open Issues: 345
-
Metadata Files:
- Readme: README.pysm
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
Combining PyJS and Python-Spidermonkey
--------------------------------------pyjs.py is a stand-alone python-to-javascript. Python-Spidermonkey
provides python bindings to the Netscape / Mozilla spidermonkey javascript
engine. The combination of the two results in python being compiled
to javascript, and then executed.pysmrun.py demonstrates how this can be achieved. It takes as input
as its first argument a filename to be compiled to javascript and
handed to the spidermonkey execution library.Dependencies
------------You will require Python-Spidermonkey from this locations:
http://pypi.python.org/pypi/python-spidermonkey
Follow the build instructions.
Testing
-------very simple!
echo print "hello" > test.py
./pysmrun.py ./test.pyWhat's Going On?
----------------pysmrun.py uses pyjs.py and simply adds pysm as yet another "platform".
Presently, the only function override that's supported is pyjslib.printFunc,
which can be found in pyjamas/library/platform/pyjslibpysm.py and this
simple example is sufficient to demonstrate the principle.In the pysm-platform-specific version of printFunc, a global routine
named "pysm_print_fn" is called. This is pre-added, before execution,
to the javascript execution context, as a global, using
python-spidermonkey's "add_global()" function.