Update README with a suggestion to use PythonMonkey #315
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pull Request suggests the usage of PythonMonkey, a Python Library for executing JavaScript in Python.
I'm happy to receive any feedback on this suggestion and modify it wherever appropriate.
PythonMonkey's API is similar to Js2Py's and its JavaScript engine is fully compatible with the newest updates to JavaScript since it leverages SpiderMonkey.
Below I'll list some examples using PythonMonkey to serve as a rationale for why it should be recommended in Js2Py's README.
Check out this Google Colab for examples on how to use PythonMonkey: https://colab.research.google.com/drive/1INshyn0gNMgULQVtXlQWK1QuDGwdgSGZ?usp=sharing
Installation
Install with:
(works with Python 3.8+ and requires npm to be installed on the system during install).
Simple Examples
toUpperCaseExample:Passing a Function Example:
PythonMonkey supports arbitrarily deeply nested JS->Py->JS->Py->... function calling between Python and JavaScript functions.
Loading a JavaScript Module in Python Example:
my-javascript-module.js
main.py
Python Loading a JavaScript Module Loading a Python Module Using CommonJS Example:
my-python-module.py
my-javascript-module.js
main.py
WebAssembly & Promise Example
Another interesting side effect of it using SpiderMonkey under the hood is that it also supports WebAssembly for free.
Here is an example: