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.

🟢 🟠 marimo + Jupyter Book

Static book. Interactive cells.

jupyter-book-marimo lets you write marimo cells in ordinary MyST pages, build your Jupyter Book as static HTML, and keep the outputs interactive in the browser.

Move the slider. The page has already been built, served, and loaded as static HTML. The Markdown below still updates because marimo hydrates the cells after the page loads.

How it works

Jupyter Book gives you MyST, navigation, cross-references, and static publishing. marimo gives you reactive Python, SQL, and Markdown cells. This plugin connects them: it executes {marimo} directives during the book build, writes static HTML output, and loads the marimo island runtime so dependent cells can react in the reader’s browser.

Quickstart

Write a MyST page with {marimo} cells.

For instance, this cell:

```{marimo} python
result = "Only the cell output is shown."
result
```

produces this output:

You can make a cell editable:

```{marimo} python
:editor: true

editor_result = "Change me" + ("!" * 3)
editor_result
```

And another cell can read its value:

But how do I run this?

Install the plugin in the same environment as Jupyter Book.

pip install jupyter-book-marimo

Register the executable plugin in myst.yml.

project:
  plugins:
    - type: executable
      path: .venv/bin/jupyter-book-marimo

Use the executable path for your book environment. When myst.yml lives in docs/ and the virtual environment lives at the repository root, use ../.venv/bin/jupyter-book-marimo.

Then write cells in any MyST page:

```{marimo} python
import marimo as mo

slider = mo.ui.slider(start=1, stop=10, step=1, label="islands")
slider
```

```{marimo} python
"🏝️" * round(slider.value)
```

Build the book:

jupyter-book build --html

The tutorials in the sidebar are marimo notebooks rendered through this plugin. Open them to see larger examples with UI, data flow, SQL, layouts, Markdown, and plots.

Reference