Skip to content
/ pythonjs Public

Basic NumPy-aware Python->JavaScript translator (experimental)

Notifications You must be signed in to change notification settings

vispy/pythonjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

pythonjs

This is part of Mozilla's collaborate project.

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. 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

About

Basic NumPy-aware Python->JavaScript translator (experimental)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published