Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/desktop-cgi/wasm-python
wasm-python wasm files to run python scripts in nodejs environments
https://github.com/desktop-cgi/wasm-python
Last synced: about 1 month ago
JSON representation
wasm-python wasm files to run python scripts in nodejs environments
- Host: GitHub
- URL: https://github.com/desktop-cgi/wasm-python
- Owner: desktop-cgi
- License: mit
- Created: 2023-07-04T09:45:31.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-25T12:34:45.000Z (about 1 year ago)
- Last Synced: 2024-04-21T02:19:33.222Z (8 months ago)
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wasm-python
wasm-python wasm files to run python scripts in nodejs environmentsUSAGE:
```
// hello_python.js
const { loadPyodide } = require("pyodide");
const path = require("path");async function hello_python() {
let pyodide = await loadPyodide({
// indexURL: "",
indexURL: path.join("./node_modules/pyodide"),
});// RUN YOUR PYTHON CODE
return pyodide.runPythonAsync("1+1");
}hello_python().then((result) => {
console.log("Python says that 1+1 =", result);
});```
Demos can be found here in the [demos](https://github.com/desktop-cgi/wasm-python/tree/main/demos) folder
This is a direct port of [npm package to run python using pyodide](https://www.npmjs.com/package/pyodide) ported for [desktop-cgi](https://github.com/desktop-cgi)
Check out more on different ways of using Python language interpretor inside of JS, Node.js here [https://pythondev.readthedocs.io/wasm.html](https://pythondev.readthedocs.io/wasm.html)
[PYODIDE](https://pyodide.org/en/stable/)