Skip to main content

Wasm Spec Kernel

A Jupyter kernel for the WebAssembly reference interpreter (see webassembly/spec).

You can try this kernel out in an example notebook using Binder:

launch Binder

Installation

Wasm Reference Interpreter

This kernel requires a Wasm reference interpreter to be available in the environment (e.g. the Wasm interpreter is not distributed with this Python package).

You can clone a WebAssembly spec repo and build the interpreter yourself using the OCaml toolchain.

@awendland provides a pre-compiled variant of the Wasm reference interpreter with language extensions for abstract types at awendland/webassembly-spec-abstypes.

Configuration

Either:

  • Place the interpreter in your $PATH with the name wasm, or
  • Specify the interpreter's location when installing the kernel with python -m wasm_spec_kernel.install --interpreter wherever_you_stored_the/interpreter

Jupyter Kernel

To install:

pip install wasm_spec_kernel
python -m wasm_spec_kernel.install

To use it, open up a new Jupyter notebook. For example, via:

jupyter notebook
# In the notebook interface, select Wasm from the 'New' menu
jupyter qtconsole --kernel wasm_spec
jupyter console --kernel wasm_spec

Purpose

This exists because the WebAssembly reference interpreter is written in OCaml and OCaml is difficult to compile to WebAssembly (otherwise the latest reference interpreter could be hosted via v1 WebAssembly already available in evergreen web browsers). A Jupyter kernel should assist with sharing WebAssembly code samples leveraging features from the various forks of the WebAssembly specification.

How This Works

For details of how this works, see the Jupyter docs on wrapper kernels, and Pexpect's docs on the replwrap module. Note that this kernel reimplements the pexpect.replwrap.REPLWrapper class so that it works better with the Wasm reference interpreter.

Acknowledgements

This was based on bash_kernel by Thomas Kluyver. Tests were adapted from jupyter/jupyter_client and ipython/ipykernel.

Metadata

Release files for wasm-spec-kernel 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wasm-spec-kernel 0.1.1
File Size Uploaded
wasm_spec_kernel-0.1.1.tar.gz 9.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wasm-spec-kernel 0.1.1
File Interpreter ABI Platform
wasm_spec_kernel-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.1 kB

Release files / wasm_spec_kernel-0.1.1.tar.gz

Download URL wasm_spec_kernel-0.1.1.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9e6cd1230cb5731cf90b3670918402fc15fb8c119afd21486531791986110f6f
BLAKE2b-256 checksum
How to use checksums
cce495fd75dfed1afb87547acd5a5a162841a455a2228ead11cb9dd2a2f972a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.9.0 Darwin/20.2.0

Release files / wasm_spec_kernel-0.1.1-py3-none-any.whl

Download URL wasm_spec_kernel-0.1.1-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
607ac41eacc8f1737eecedab2da7f7902ac73d272fefc39a222c43b95f5004f9
BLAKE2b-256 checksum
How to use checksums
2a98aad69dfecbf5beada786d891d61e9900ad67421ed3129a1087c2b9e95377
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.9.0 Darwin/20.2.0

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page