center

TU Delft - Digital Competence Centre

These slides were made with Marp and are available online.

Contents

  1. Introduction to JupyterLite
  2. Discuss use cases and alternatives
  3. Set up a JupyterLite instance on GitHub
  4. Configuring Jupyterlite
  5. Embed jupyterlite in documentation

What is JupyterLite?

https://jupyterlite.readthedocs.io/en/latest/index.html

JupyterLite is a JupyterLab distribution that runs entirely in the browser built from the ground-up using JupyterLab components and extensions.

Goal: provide a lightweight computing environment without having to install anything on the end-user device.

Status: The project in under active development by core Jupyter developers and is still unofficial.

For example, I can now run Python code in my slides!

Features

Various flavours

  • JupyterLab
  • RetroLab
  • REPL (Read-Evaluate-Print Loop)

Multiple kernels

  • Python
  • Javascript
  • p5.js

Demo: https://jupyterlite.github.io/demo/lab/index.html

Mutiple deployment options

  • Deploy your first JupyterLite website on GitHub Pages
  • Deploying on ReadTheDocs with jupyterlite-sphinx
  • Deploying on Vercel and Netlify
  • Deploying on GitLab Pages
  • Deploying on Binder with jupyter-server-proxy

Blog on deployment options

Back-end

JupyterLite came out of Pyodide, which consists of the CPython 3.10 interpreter compiled to WebAssembly which allows Python to run in the browser. Pyolite runs in a Web Worker and thus doesn’t block the main UI thread when intensive computations are executed.

  • Pyolite is now powered by IPython, providing access to magics, code completion, rich display, interactive widgets, and many other features
  • Initial support for interactive visualization libraries such as altair, bqplot, ipywidgets, matplotlib, and plotly
  • View hosted example Notebooks and other files, then edit, save, and download from the browser’s IndexDB (or to localStorage)

Supported packages

Pyodide can install any Python package with a pure Python wheel from the Python Package Index (PyPI) at runtime. For example to install altair:

%pip install -q altair

which translates to

import piplite
await piplite.install("altair")
  • Example notebook available with all the pip installation options.
  • Packages containing C extensions will need to be rebuild for Pyodide. Already available are numpy, pandas, scipy, matplotlib, and scikit-learn.

Use cases

  • Sharing educational course content
  • Sharing computational work or papers
  • Live demonstrations
  • Generating interactive open-source package documentation
  • Backup environment for teaching
  • ...

Overview of alternatives

What are the current solutions and what would we recommend?

Resources

Deploy JupyterLite on GitHub Pages

Instructions: https://jupyterlite.readthedocs.io/en/latest/quickstart/deploy.html

Configuring JupyterLite