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.
pip install marimoVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates creating a simple reactive marimo notebook. Save this code as a `.py` file (e.g., `my_notebook.py`) and run `marimo edit my_notebook.py` in your terminal to open it in your browser. The second cell will automatically update as you interact with the slider in the first cell.
Avoid in-place mutations of objects across cell boundaries. Instead, reassign variables to new objects, or ensure all operations on a specific object occur within the same cell that defines it.
Refactor your code to ensure each variable is assigned a value in only one cell. Use local variables or pass values between cells explicitly.
Use explicit imports (e.g., `import marimo as mo` or `from marimo.ui import slider`) instead of wildcard imports.
Analyze your cell dependencies and refactor your code to break any circular references. This typically involves rethinking data flow and variable assignments.
Isolate UI element definitions in cells that do not have upstream dependencies that would cause them to re-execute unnecessarily. Use `mo.state` for persistent, mutable state across reruns if an element's value needs to survive cell re-execution without resetting.
To share notebooks with rendered outputs on GitHub, configure marimo to automatically snapshot outputs to an `.ipynb` file or use services like molab for live previews.
Replace `from module import *` with explicit imports, such as `import module` and then access members using `module.item`, or `from module import specific_item`.
Consolidate the definition of a variable into a single cell. Use marimo's built-in dataflow tools (minimap, variables explorer, or dependency graph) to visualize variable definitions and references and refactor your code accordingly.
Explicitly use `mo.ui.plotly()` to render Plotly figures, or ensure that the default Plotly renderer is set to a simple key that marimo can directly access. Upgrading marimo to a newer version might also resolve this, as a fix was discussed on GitHub.
Before converting, edit the original Jupyter notebook to remove any trailing double quotes from markdown cells that are causing the conversion to fail.