python-wasm
Advanced tools
+3
-3
@@ -71,5 +71,5 @@ OPT = -O ReleaseFast | ||
| bench: | ||
| echo "STARTING wapython benchmark suite" | ||
| ../../bin/wapython `pwd`/../jpython/bench/all.py | ||
| echo "FINISHED wapython benchmark suite" | ||
| echo "STARTING python-wasm benchmark suite" | ||
| ../../bin/python-wasm `pwd`/../jpython/bench/all.py | ||
| echo "FINISHED python-wasm benchmark suite" | ||
@@ -76,0 +76,0 @@ .PHONY: clean |
+4
-4
| { | ||
| "name": "python-wasm", | ||
| "version": "0.4.0", | ||
| "version": "0.4.1", | ||
| "description": "python-wasm -- Web Assembly Python for Node.js and the Browser", | ||
@@ -17,3 +17,3 @@ "main": "./dist/python/node.js", | ||
| "type": "git", | ||
| "url": "git+https://github.com/sagemathinc/wapython.git" | ||
| "url": "git+https://github.com/sagemathinc/python-wasm.git" | ||
| }, | ||
@@ -24,5 +24,5 @@ "keywords": ["python", "webassembly"], | ||
| "bugs": { | ||
| "url": "https://github.com/sagemathinc/wapython/issues" | ||
| "url": "https://github.com/sagemathinc/python-wasm/issues" | ||
| }, | ||
| "homepage": "https://github.com/sagemathinc/wapython/tree/main/packages/python-wasm", | ||
| "homepage": "https://github.com/sagemathinc/python-wasm/tree/main/packages/python-wasm", | ||
| "workspaces": ["../wasi"], | ||
@@ -29,0 +29,0 @@ "dependencies": { |
+28
-12
| # python\-wasm: WebAssembly CPython for Node.js and the browser | ||
| See [the main repo](https://github.com/sagemathinc/wapython/blob/main/README.md) for more information. | ||
| See [the main repo](https://github.com/sagemathinc/python-wasm/blob/main/README.md) for more information. | ||
| ## Using wapython from node.js | ||
| ## Using from node.js | ||
| The following should work with nodejs version 16.x on Linux, MacOS, and **native** Microsoft Windows. \(NOTE: for node 14, use the `--experimental-wasm-bigint` flag.\) | ||
| Install the package: | ||
| ```sh | ||
| wstein@max % mkdir wapython && cd wapython && npm init -y | ||
| wstein@max % npm install python-wasm | ||
| npm install python-wasm | ||
| ``` | ||
| The library should work with nodejs version 16.x on Linux, MacOS, and **native** Microsoft Windows. \(NOTE: for node 14, use the `--experimental-wasm-bigint` flag.\) | ||
| ```sh | ||
| wstein@max % node | ||
| Welcome to Node.js v16.13.0. | ||
| Type ".help" for more information. | ||
| > python = require('pthon-wasm') | ||
| > python.exec('a=2+3; a') # outputs to stdout | ||
| 5 | ||
| > python = require('python-wasm') | ||
| > await python.init() | ||
| > python.exec('a = sum(range(101)); a') # outputs to stdout | ||
| 5050 | ||
| > s = python.repr('a'); s # javascript string | ||
| 5 | ||
| 5050 | ||
| > python.exec('import sys; sys.version') | ||
| '3.11.0b3 (main, Jul 8 2022, 23:21:07) [Clang 13.0.1 (git@github.com:ziglang/zig-bootstrap.git 81f0e6c5b902ead84753490d' | ||
| > python.exec('import sys; sys.platform') | ||
| > python.repr('sys.platform') | ||
| 'wasi' | ||
| ``` | ||
| ## Using python\-wasm in a web application | ||
| ## Using in a web application | ||
| See https://github.com/sagemathinc/wapython/tree/main/packages/webpack for how to use Webpack5 with python\-wasm. | ||
| See [this repo](https://github.com/sagemathinc/python-wasm/tree/main/packages/webpack) for how to use Webpack5 with python\-wasm. | ||
| ## API | ||
| The `python-wasm` module exports four things: | ||
| - `init` \- async function; call to ensure WASM code has been initialized | ||
| - `exec(code:string)` \- execute code \(output goes to /dev/stdout and /dev/stderr\) | ||
| - `repr(expr:string)` \- return representation of an expression as a string | ||
| - `wasm` \- object that is defined after `await init()` succeeds. | ||
| - `wasm.fs` \- the [memfs](https://www.npmjs.com/package/memfs) filesystem | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
9831353
0.26%45
55.17%3
-25%