xeus kernels in JupyterLite 🚀🪐#

Xeus logo

jupyterlite-xeus is an extension for JupyterLite that enables fully client-side Jupyter environments powered by xeus kernels compiled to WebAssembly (Wasm). It allows users to create statically-served Jupyter deployments with custom pre-built environments — no server required.

The core feature of jupyterlite-xeus is its integration with emscripten-forge, a conda package distribution tailored for WebAssembly. This makes it possible to bundle your favorite scientific or data analysis packages directly into the browser-based environment, delivering a reproducible computing experience with zero backend dependencies.

Ideal for demos, educational resources, and offline computing. Use it in combination with Voici!

Currently supported kernels are:

Try it here!

Try Lua!
Try R!
Try C++!

Installation#

You can install jupyterlite-xeus with conda/mamba

mamba install -c conda-forge jupyterlite-xeus

Or with pip (you must install micromamba 2.0.5):

pip install jupyterlite-xeus

Usage#

Once installed, you can create an environment.yml file at the root of your jupyterlite build directory containing the following:

name: xeus-kernels
channels:
  - https://repo.prefix.dev/emscripten-forge-dev
  - https://repo.prefix.dev/conda-forge
dependencies:
  - xeus-python
  - xeus-lua
  - xeus-nelson
  - numpy
  - matplotlib
  - pillow
  - ipywidgets
  - pip:
      - ipycanvas

You can then run the usual jupyter lite build or voici my-notebook.ipynb. The environment.yml file will be picked-up automatically by jupyterlite-xeus, installing xeus-python, xeus-lua, xeus-nelson and some useful Python packages into the user environment.

Features#

Dynamic install of packages#

Starting with jupyterlite-xeus v4.0.0a11, you can use the %pip magic or the %mamba magics to install packages dynamically once the kernel started:

%pip install my_package

or

%mamba install my_package

stdin#

Starting with jupyterlite-xeus v4.0.0a8, latest jupyterlite 0.6.0, and latest xeus kernels (tested in Python, C++, lua), blocking stdin is now supported:

name = input("what's your name")

Multiple kernels#

To create a deployment with multiple kernels, you can simply add them to the environment.yml file:

name: xeus-lite-wasm
channels:
  - https://repo.prefix.dev/emscripten-forge-dev
  - https://repo.prefix.dev/conda-forge
dependencies:
  - xeus-python
  - xeus-lua
  - xeus-sqlite
  - numpy

Learn more in Emscripten Environment

Mounting additional files#

To copy additional files and directories into the virtual filesystem of the xeus-lite kernels you can use the --XeusAddon.mount option. Each mount is specified as a pair of paths separated by a colon :. The first path is the path to the file or directory on the host machine, the second path is the path to the file or directory in the virtual filesystem of the kernel.

jupyter lite build \
    --XeusAddon.environment_file=environment.yml \
    --XeusAddon.mounts=/some/path/on/host_machine:/some/path/in/virtual/filesystem

Learn more in Accessing and managing files

Learn more#