Interactive computing in the browser with Jupyterlite

JOBIM 2024

Jérémy Tuloup

https://jtp.io/jobim-2024

@jtpio @QuantStack

Jérémy Tuloup

  • Technical Director à QuantStack
  • Jupyter Distinguished Contributor
  • Jupyter Frontends SSC (Steering Software Council) representative
  • Contributor and maintainer of many Jupyter projects
  • JupyterLite creator
@jtpio @QuantStack

Quick History

@jtpio @QuantStack

IPython in the terminal

fit

@jtpio @QuantStack

REPL: Read Eval Print Loop

@jtpio @QuantStack

Why are notebooks popular ?

  • REPL workflow
  • with:
    • narration
    • memory
    • reproducibility
    • communication
@jtpio @QuantStack

IPython Notebook

fit

@jtpio @QuantStack

Jupyter Notebook

fit

@jtpio @QuantStack

JupyterLab

fit

@jtpio @QuantStack

LIGO

@jtpio @QuantStack

Black Hole M87

@jtpio @QuantStack

The Jupyter ecosystem

@jtpio @QuantStack
@jtpio @QuantStack
@jtpio @QuantStack

JupyterLite

  • Everything runs in the browser via WebAssembly
  • Based on the Jupyter stack:
    • Pyodide and Xeus kernels run code in the browser
    • JupyterLab and Jupyter Notebook interfaces
    • Voici for web applications and dashboards
@jtpio @QuantStack

Jupyter

center

@jtpio @QuantStack

JupyterLite

center

@jtpio @QuantStack
@jtpio @QuantStack

Wasm powered Jupyter running in the browser

center

@jtpio @QuantStack

Python in the browser

center

  • Pyodide
  • CPython compiled to WebAssembly
  • Xeus Python + Emscripten Forge
@jtpio @QuantStack
@jtpio @QuantStack

Jupyter and Python in the browser

center

  • ✅ no Python server
  • ✅ no command line for users
  • ✅ no need to install Python and other packages locally
  • ✅ can be hosted as a static site
@jtpio @QuantStack

A Jupyter web site available in a few seconds

center

@jtpio @QuantStack

jupyterlite-core: a static site generator

pip install jupyterlite-core

jupyter lite build
@jtpio @QuantStack

HTML, CSS, JavaScript, Wasm files

├── api
│   └── translations
│       ├── all.json
│       └── en.json
├── bootstrap.js
├── build
│   ├── 9507.1e6cc5d.js
│   ├── 9602.62bf0f1.js
│   ├── 9621.e2e8b5d.js
│   ├── ...
│   ├── repl
│   │   ├── bundle.js
│   ├── retro
│   │   ├── bundle.js
│   ├── schemas
│   │   ├── all.json
│   │   ├── @jupyterlab
│   │   │   ├── application-extension
│   │   │   │   ├── commands.json
│   │   │   │   ├── context-menu.json
│   │   │   │   ├── shell.json
│   │   │   │   └── sidebar.json
│   ├── themes
│   │   └── @jupyterlab
│   │       ├── theme-dark-extension
│   │       │   ├── index.css
│   │       │   └── index.js
...
...
│   │       └── theme-light-extension
│   │           ├── index.css
│   │           └── index.js
├── config-utils.js
├── extensions
│       └── xeus-python-kernel
│           └── static
│               ├── numpy-1.24.2-py310h6d2fff6_0.0.data
│               ├── numpy-1.24.2-py310h6d2fff6_0.0.js
│               ├── python-3.10.2-h_hash_26_cpython.0.data
│               ├── python-3.10.2-h_hash_26_cpython.0.js
│               ├── python_data.js
│               ├── remoteEntry.35b4eac217ec6bf078a4.js
├── lab
│   ├── favicon.ico
│   ├── index.html
│   ├── jupyter-lite.ipynb
│   ├── jupyter-lite.json
│   ├── package.json
│   ├── tree
│   │   └── index.html
│   └── workspaces
│       └── index.html
...
@jtpio @QuantStack

Easy to deploy

Served via well-cacheable, static HTTP(S) on most static web hosts

center
center
center

center
center
center

@jtpio @QuantStack

Use cases

@jtpio @QuantStack

center

<iframe
  src="https://jupyterlite.github.io/demo/repl/index.html?kernel=python&toolbar=1"
  width="100%"
  height="500px"
>
</iframe>
@jtpio @QuantStack
@jtpio @QuantStack
@jtpio @QuantStack

@jtpio @QuantStack

https://github.com/rowanc1/myst-lite

@jtpio @QuantStack

🎓 Education

@jtpio @QuantStack

⌛ Reproducibility time capsule

  • WebAssembly is a web standard
  • Runnable for much longer than native binary packages

center

@jtpio @QuantStack

🚀 Deploy to GitHub Pages

center

@jtpio @QuantStack

https://jupyterlite.github.io/demo/

@jtpio @QuantStack

🧪 Current developments

  • In-browser terminal
  • AI code completions and chat
  • Real Time Collaboration via WebRTC
  • Emscripten Forge and Conda Forge
@jtpio @QuantStack

✨ Demo ✨

https://jtpio.github.io/jobim-2024/lite

@jtpio @QuantStack

✨ AI code completions and chat

@jtpio @QuantStack

🔍 References

@jtpio @QuantStack

Thanks !

@jtpio @QuantStack