Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Tutorial 1: In-Browser Execution with JupyterLite

Open In Colab Open In Kaggle

Tutorial 1: In-Browser Execution with JupyterLite

This book uses JupyterLite to run Python directly in your browser. No server, no installation required — everything runs via WebAssembly (WASM).

How to run code in the browser

Every code cell on this page is an editor. Edit the code and press ▶ Run (or Shift-Enter). The first run takes ~10 seconds while Python starts. Running a cell first runs the cells above it that haven’t run yet, as in a notebook.

A heavy tutorial (for example one that needs PyTorch) can opt out with runtime: colab in its frontmatter. The page then shows its code read-only, with a banner that links to Colab and Kaggle.

Try it: basic computation

Try it: NumPy in the browser

Try it: matplotlib in the browser

How JupyterLite is configured

In myst.yml, the setting project.jupyter.lite: true enables the in-browser kernel for all pages that have a kernelspec in their frontmatter:

project:
  jupyter:
    lite: true

Pages without kernelspec (like further_reading.md) stay static — only pages that declare a kernelspec get editable, runnable cells.

For students: running in Colab or Kaggle

Every tutorial page with executable code has Colab and Kaggle badges at the top of the page and of its generated notebook. CI adds them automatically, so you never add them by hand. See Day 3, Tutorial 2 for how this works.