A wasm kernel for Jupyter
Project description
Wasm Spec Kernel
A Jupyter kernel for the WebAssembly reference interpreter (see webassembly/spec).
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 namewasm
, 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
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
Built Distribution
File details
Details for the file wasm_spec_kernel-0.1.0.tar.gz
.
File metadata
- Download URL: wasm_spec_kernel-0.1.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.9.0 Darwin/20.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1dde1c6a07683407f5f1040aa72c138bc711ad2ab590a72c6988213de7f0ea61 |
|
MD5 | 9a4931bf1b6448d747ecc9929334ecc7 |
|
BLAKE2b-256 | ebbabb3bda83ef5846af9c9a8f32e4679e430d296c7928ef621e784f7a7c78b2 |
File details
Details for the file wasm_spec_kernel-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: wasm_spec_kernel-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.9.0 Darwin/20.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1983f60577ef19bf6b5d4e7e9ffe54f0da7c3d6e11eea7e247887278d6a251f |
|
MD5 | c6dee5689b6a2a23dfb28bcb23d1e457 |
|
BLAKE2b-256 | 571016b48457ea437ed7bb7ee9f424f64bdc4ded0adbbd0cc665aa6cf81743c9 |