marimo
Original:🇺🇸 English
Translated
Guide for creating and working with marimo notebooks, the reactive Python notebook that stores as pure .py files. This skill should be used when creating, editing, running, or deploying marimo notebooks.
8installs
Sourcemaragudk/skills
Added on
NPX Install
npx skill4agent add maragudk/skills marimoTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →marimo
Overview
marimo is an open-source reactive Python notebook that reinvents notebooks as reproducible, interactive, and shareable Python programs. Unlike traditional Jupyter notebooks, marimo notebooks:
- Store as pure files (Git-friendly, no JSON)
.py - Execute reactively (like a spreadsheet)
- Run as scripts or deploy as web apps
- Prevent bugs through automatic dependency tracking
Installation
bash
pip install marimo # Basic
pip install marimo[recommended] # With extras
pip install marimo[sql] # With SQL support
marimo tutorial intro # Start tutorialCLI Commands
bash
# Edit
marimo edit # New notebook
marimo edit notebook.py # Edit existing
marimo edit --watch --sandbox # Watch files, isolate deps
# Run as app
marimo run notebook.py # Read-only app
marimo run notebook.py --watch # Auto-reload on changes
# Run as script
python notebook.py
# Create from prompt
marimo new "analyze sales data"
# Convert
marimo convert notebook.ipynb -o notebook.py
# Export
marimo export html notebook.py -o output.html
marimo export html-wasm notebook.py -o output.html # Browser-executableKey Concepts
Reactivity
Running a cell automatically runs all cells that depend on it. Execution order is determined by variable dependencies (DAG), not cell position.
Cell Rules
- Each global variable must be defined in exactly one cell
- Mutations like aren't tracked; reassign instead
list.append() - If mutating is needed, do it in the same cell as the declaration
File Format
Notebooks are pure Python files with marimo decorators:
python
import marimo
app = marimo.App()
@app.cell
def _():
import marimo as mo
return (mo,)
@app.cell
def _(mo):
mo.md("# My Notebook")
return ()API Reference
Detailed documentation for each API is available in the directory. Consult these files for comprehensive examples and parameters.
references/Core
| API | Reference File | Description |
|---|---|---|
| Markdown | | |
| HTML | | |
| Outputs | | |
UI Elements
| API | Reference File | Description |
|---|---|---|
| Inputs | | Sliders, text, dropdowns, tables, forms, etc. |
| Layouts | | |
| Media | | Images, audio, video, PDF, downloads |
| Plotting | | Altair, Plotly, matplotlib integration |
| Diagrams | | Mermaid diagrams |
| Status | | Progress bars, spinners |
Data
| API | Reference File | Description |
|---|---|---|
| SQL | | |
Advanced
| API | Reference File | Description |
|---|---|---|
| Control Flow | | |
| State | | |
| Caching | | |
| Query Params | | |
| CLI Args | | |
| Watch | | |
| App | | Embedding notebooks, |
| Cell | | Cross-notebook execution, testing |
Quick Examples
Basic UI
python
import marimo as mo
slider = mo.ui.slider(0, 100, value=50, label="Threshold")
slider
# In another cell
mo.md(f"Selected value: **{slider.value}**")Interactive Table
python
table = mo.ui.table(df, selection="multi")
table
# In another cell
selected = table.value # Selected rows as DataFrameSQL Query
python
result = mo.sql(f"SELECT * FROM {df} WHERE value > {threshold.value}")Conditional Execution
python
mo.stop(form.value is None, mo.md("Submit the form to continue"))
# Rest of cell runs only after form submissionRunning as Apps
bash
marimo run notebook.py # Local app
marimo export html-wasm notebook.py # Static WASM appLayout options: Vertical (default), Grid (drag-drop in editor), Slides.
Best Practices
- Reactivity: Declare and mutate variables in the same cell
- Performance: Use for expensive computations
@mo.cache - UI Gating: Use to prevent expensive ops until ready
mo.stop() - State: Avoid unless synchronizing multiple UI elements
mo.state() - Organization: Cell position doesn't matter; organize for readability