Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/distributive-network/pythonmonkey-examples
https://github.com/distributive-network/pythonmonkey-examples
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/distributive-network/pythonmonkey-examples
- Owner: Distributive-Network
- Created: 2023-06-27T12:38:07.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-23T18:47:42.000Z (8 months ago)
- Last Synced: 2024-04-25T00:28:29.172Z (8 months ago)
- Language: Python
- Size: 21.5 KB
- Stars: 8
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PythonMonkey Examples
## What is PythonMonkey
[PythonMonkey](https://pythonmonkey.io/) is a Python library for executing JavaScript in Python
and executing Python in JavaScript. It uses [Mozilla's SpiderMonkey](https://firefox-source-docs.mozilla.org/js/index.html)
JavaScript Engine and shares memory with Python for fast execution.Check out [PythonMonkey on GitHub](https://github.com/Distributive-Network/PythonMonkey#pythonmonkey)!
## Installation
- requires Python 3.8 or higher
```bash
pip install pythonmonkey
```## Running Examples
- Run the examples via `python3`. Refer to the README.md files in each of the directories for more information.## Examples:
- `hello-world-eval.py`
- A "Hello, World" which evaluates a string in JavaScript
- Run with `python3 hello-world-eval.py`
- `function-call-eval.py`
- Calling a JavaScript function in Python
- Run with `python3 function-call-eval.py`
- `function-passing-eval.py`
- Calling a Python function in a JavaScript function from Python
- Run with `python3 function-passing-eval.py`
- `require-js-file-from-py/`
- Loading a JavaScript module from Python
- `require-py-file-from-js/`
- Loading a Python module from JavaScript
- `require-npm-package-from-py/`
- Using an NPM package directly from Python
- `require-npm-packages/`
- Calling JavaScript code that uses NPM modules
- `load-wasm-from-py/`
- Loading a WebAssembly module in Python and calling WASM function
- `promises/`
- Using JavaScript promises in Python## Fullstack Example using CryptoJS
For a more in depth example using the CryptoJS NPM package, refer to [https://github.com/Distributive-Network/PythonMonkey-Crypto-JS-Fullstack-Example](https://github.com/Distributive-Network/PythonMonkey-Crypto-JS-Fullstack-Example/).