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.
Metadata
Release files for wasmjs 0.0.15.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wasmjs-0.0.15.0.2.tar.gz | 12.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wasmjs-0.0.15.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.5 kB
Release files / wasmjs-0.0.15.0.2.tar.gz
| Download URL | wasmjs-0.0.15.0.2.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cca77e39b847b063822cad8f359d0ae6953407d75eea50e421ec81d2f9cf9710
|
|
BLAKE2b-256 checksum How to use checksums |
d1e7014ddd880def660a00c8a86f61644c561c56c53bb6bd8d27c18f8611be9d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / wasmjs-0.0.15.0.2-py3-none-any.whl
| Download URL | wasmjs-0.0.15.0.2-py3-none-any.whl |
|---|---|
| Size | 14.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
822e142d8ee01f3c56bb531ad989c6110a61e15bee6d6d1448e415e83285fc44
|
|
BLAKE2b-256 checksum How to use checksums |
a6a998e9acf4aa51a4aad1ae7010d9c6ee39ef3ef7c1b05dddee9333714101e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|