Make Jupyter Book pages reactive with marimo.
Jupyter Book builds books and documentation sites from MyST
Markdown and notebooks. jupyter-book-marimo adds reactive Python, SQL, and Markdown
cells to its MyST pages.
The plugin compiles each page's {marimo} cells into one marimo app. Jupyter Book
places each result at its authored position and publishes the surrounding book as static
HTML.
The browser runtime then hydrates the shared app so controls and dependent cells stay interactive across ordinary MyST sections.
Requires Python 3.10 or newer.
Install the plugin in the environment that builds the book:
pip install jupyter-book-marimoRegister its executable in myst.yml:
project:
plugins:
- type: executable
path: .venv/bin/jupyter-book-marimoPaths are resolved from myst.yml. On Windows, use
.venv/Scripts/jupyter-book-marimo.exe. A myst.yml in docs/ uses a path beginning
with ../.venv/.
Write reactive cells in a MyST page:
```{marimo} python
import marimo as mo
slider = mo.ui.slider(start=1, stop=10, label="items")
slider
```
```{marimo} python
mo.md(f"The slider is set to **{slider.value}**.")
```Build the book:
jupyter-book build --htmlThe plugin compiles every page into one marimo app. Each visible cell becomes an island backed by that shared app, so dataflow continues across ordinary MyST sections. The static output renders before the browser runtime starts.
Use {marimo-config} for page defaults, setup code, and dependencies:
```{marimo-config}
:echo: true
:pyproject: |
requires-python = ">=3.10"
dependencies = ["pandas"]
```Read the user documentation for authoring options, page configuration, styling, and runtime assets.
See CONTRIBUTING.md for local development.