marimo Reactive Python Notebook
marimo is an open-source reactive Python notebook library that enhances traditional notebooks by guaranteeing consistency between code and outputs. It stores notebooks as pure Python files, making them Git-friendly, executable as standalone scripts, and deployable as interactive web applications. marimo also provides built-in UI elements and first-class SQL support. The current version is 0.23.1, and the project has an active development and release cadence.
Warnings
- breaking marimo's reactive model does not track mutations to objects across cells. If you modify an object in one cell and expect another dependent cell to react to that mutation, it will not work as expected. Instead, create new objects or perform all mutations within a single cell to ensure reactivity.
- breaking Each variable can be defined in only one cell to ensure a clear and reproducible execution order. Defining the same variable in multiple cells will result in an error.
- breaking marimo does not allow `import *` (importing all symbols from a library) to prevent ambiguity and maintain a well-defined dependency graph.
- breaking Circular dependencies between cells are not allowed. If Cell A depends on Cell B, Cell B cannot simultaneously depend on Cell A. This prevents infinite loops and ensures a deterministic execution flow.
- gotcha UI elements (e.g., `mo.ui.slider`) will reset to their initial `value` argument if the cell defining them reruns. This can happen if the cell itself depends on other changing variables.
- gotcha marimo notebooks are pure Python files (`.py`), which means GitHub does not render their outputs directly like Jupyter's `.ipynb` files.
Install
-
pip install marimo -
pip install "marimo[sql]"
Imports
- marimo
import marimo as mo
- ui elements
mo.ui.slider(...) mo.ui.dropdown(...)
Quickstart
import marimo as mo
# Create an interactive slider
slider = mo.ui.slider(1, 100, value=50, label="Select a value")
slider
# A reactive cell that uses the slider's value
# This cell will automatically re-run when the slider moves.
mo.md(f"The current value is **{slider.value}**")