https://github.com/vispy/pythonjs
Basic NumPy-aware Python->JavaScript translator (experimental)
https://github.com/vispy/pythonjs
Last synced: 10 months ago
JSON representation
Basic NumPy-aware Python->JavaScript translator (experimental)
- Host: GitHub
- URL: https://github.com/vispy/pythonjs
- Owner: vispy
- Created: 2014-10-10T16:24:22.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-10-10T19:32:33.000Z (about 11 years ago)
- Last Synced: 2025-01-17T06:32:37.018Z (11 months ago)
- Homepage:
- Size: 129 KB
- Stars: 3
- Watchers: 10
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
pythonjs
========
[This is part of Mozilla's collaborate project](http://collaborate.mozillascience.org/projects/hpdataVis).
This is a *very basic* Python->JavaScript translator written in Python. This translator will convert relatively simple Python/NumPy functions to JavaScript, using our [numpy.js](https://github.com/vispy/numpy.js). Typically, these functions will be interactivity functions (like callback functions reacting to mouse movements, key strokes...) and emitting GLIR (OpenGL) commands to update the visualization.
We'll start from PythonJS and Pythonium code. We'll only support the most common Python/NumPy syntactic constructs. The code of these projects is based on the Python `ast` module. They generate JavaScript code dynamically while visiting the Python AST.
* `for` loops
* `if`
* NumPy indexing (converted to `get` and `set` in numpy.js)
* function calls and definitions
* tuples and lists converted to arrays
Vispy-specific features:
* Vispy gloo commands will be translated to vispy.gloo.js calls
* There should be a global symbol table that is used to access gloo objects in both Python and JavaScript
## Features not implemented
These features won't be implemented, at least in a first approach. The idea is to only support numerical computing functions relying on the `ndarray` structure.
* Classes
* Dynamic features (`getattr` and co)
* Most Python builtin functions