Simple wrapper around QuickJS-NG's qjs-wasi-reactor.wasm.
Project description
wasmjs
Simple Python wrapper around QuickJS-NG's qjs-wasi-reactor.wasm.
Quickstart
$ python -m venv my-project
$ source my-project/bin/activate
$ pip install wasmjs
$ python
>>> from wasmjs import wasmjs
>>> js = wasmjs.WasmJS()
>>> js.eval('1 + 2')
3
>>> js.eval('("hello" + "there").toUpperCase()')
'HELLOTHERE'
>>> js.eval('({one: 1, two: 2})')
{'one': 1, 'two': 2}
Structure
qjs-wasi-reactor.wasm is essentially 3 build targets statically linked together:
- QuickJS-NG JavaScript library (
JS_Eval, etc.) - QuickJS-NG
qjsCLI tool (qjs_init, etc.) - Bytecode Alliance
wasi-libcC standard library implementation (malloc, etc.)
The API bindings for each component are separated into:
WasmFileqjs-wasi-reactor.wasmloader. Wrapswasmtime-py, which itself wrapsWasmtime, which is a WebAssembly runtime.
api.wasilibcmallocthat changes the return type ofwasi-libc'smallocfrom anint32to auint32, etc.
api.memutil- Convenience functions to get strings and other complex types into and out of the Wasm virtual machine.
api.qjsJS_Evalthat keeps track of the global context, etc.
api.js- Convenience functions to handle all of the multi-step
qjsflows.
- Convenience functions to handle all of the multi-step
jsvalueutil- All of the logic needed to get data into and out of the JS virtual machine (inside the Wasm virtual machine).
WasmJS- Convenience layer to simplify all of the above.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wasmjs-0.0.14.0.3.tar.gz
(10.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wasmjs-0.0.14.0.3.tar.gz.
File metadata
- Download URL: wasmjs-0.0.14.0.3.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dfec91b6d4b852d5becedbb49c8404927c0f95efbfa1ab1d8d417bd5af56ac2
|
|
| MD5 |
cc42d308efac3709e2729690743c10a9
|
|
| BLAKE2b-256 |
f05e1a56d7fd29e025dfcced593165574f3e0070b25b05c5d9e982f4e5e93d6d
|
File details
Details for the file wasmjs-0.0.14.0.3-py3-none-any.whl.
File metadata
- Download URL: wasmjs-0.0.14.0.3-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0d072e4ab03ac7dc0786613a94b839682a2bfe0eaeaf6d02b8da8f3eebb9172
|
|
| MD5 |
2ea66107e8851fbd4623aa8f609b6014
|
|
| BLAKE2b-256 |
19864d89f5f25279e550683acb4061f95492c40c9fb5d23fa964dd03ca1c6a38
|