Thebe (In-Browser Execution)#
Thebe turns a static HTML page into a lightweight interactive notebook: code cells become executable in the browser by connecting to a live Jupyter kernel backend (most commonly Binder or a JupyterHub).
This is optional. The default workflow for this book is still:
open the notebooks in VS Code
run them locally
When Thebe Works (And When It Doesn’t)#
Thebe requires:
a publicly reachable kernel backend (Binder/JupyterHub)
a repository that Binder can build (needs a Python environment specification)
If the kernel cannot start, the page remains readable and you can fall back to local execution.
Config Knobs (Jupyter Book)#
This book uses:
launch_buttons.thebeinbook/_config.ymlto toggle Theberepository.urlto tell Binder which repo to build
If you fork this project, update repository.url to your fork.
Binder Environment (Minimal)#
Binder needs one of the standard environment files in the repository root, for example:
requirements.txtenvironment.ymlpyproject.toml
For this book, a minimal requirements.txt typically includes:
ipywidgets(optional, for widget mode)
Everything else used in the core chapters is standard library Python.
Local Fallback#
If Thebe is unavailable, run locally:
jupyter-book build book --all
Then open book/notebooks/*.ipynb in VS Code and execute the cells.