Skip to main content

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:

The API bindings for each component are separated into:

  • WasmFile
  • api.wasilibc
    • malloc that changes the return type of wasi-libc's malloc from an int32 to a uint32, etc.
  • api.memutil
    • Convenience functions to get strings and other complex types into and out of the Wasm virtual machine.
  • api.qjs
    • JS_Eval that keeps track of the global context, etc.
  • api.js
    • Convenience functions to handle all of the multi-step qjs flows.
  • 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


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.15.0.2.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wasmjs-0.0.15.0.2-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file wasmjs-0.0.15.0.2.tar.gz.

File metadata

  • Download URL: wasmjs-0.0.15.0.2.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for wasmjs-0.0.15.0.2.tar.gz
Algorithm Hash digest
SHA256 cca77e39b847b063822cad8f359d0ae6953407d75eea50e421ec81d2f9cf9710
MD5 8fde5266d60de78fe774ba06561600a5
BLAKE2b-256 d1e7014ddd880def660a00c8a86f61644c561c56c53bb6bd8d27c18f8611be9d

See more details on using hashes here.

File details

Details for the file wasmjs-0.0.15.0.2-py3-none-any.whl.

File metadata

  • Download URL: wasmjs-0.0.15.0.2-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for wasmjs-0.0.15.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 822e142d8ee01f3c56bb531ad989c6110a61e15bee6d6d1448e415e83285fc44
MD5 2c7055b8f9afc38bad6729480a5958ad
BLAKE2b-256 a6a998e9acf4aa51a4aad1ae7010d9c6ee39ef3ef7c1b05dddee9333714101e7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page