mcpField
M
marimo

marimo

github.com/maragudkData & databases4955 installsUpdated 31w ago
Repository

About marimo

marimo is an open-source skill for working with reactive Python notebooks stored as plain `.py` files. It supports interactive analysis and running notebooks as scripts or web apps.

Key features

  1. 01Reactive cell execution
  2. 02Store notebooks as `.py` files
  3. 03Build interactive UI elements
  4. 04Query data with SQL
  5. 05Run notebooks as scripts or web apps

Use cases

  1. 01Explore data with reactive Python cells
  2. 02Create interactive tables and controls
  3. 03Query DataFrames with SQL
  4. 04Publish a notebook as a web app

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/maragudk/skills --skill marimo

After installing, type/marimoin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
app.md
caching.md
cell.md
cli-args.md
control-flow.md
diagrams.md
html.md
inputs.md
layouts.md
markdown.md
media.md
outputs.md
plotting.md
query-params.md
sql.md
state.md
status.md
watch.md

Details

From the project README

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 .py files (Git-friendly, no JSON)
  • Execute reactively (like a spreadsheet)
  • Run as scripts or deploy as web apps
  • Prevent bugs through automatic dependency tracking

Installation

pip install marimo                    # Basic
pip install marimo[recommended]       # With extras
pip install marimo[sql]               # With SQL support

marimo tutorial intro                 # Start tutorial

CLI Commands

# 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-executable

Key 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
  1. Each global variable must be defined in exactly one cell
  2. Mutations like list.append() aren't tracked; reassign instead
  3. If mutating is needed, do it in the same cell as the declaration
File Format

Notebooks are pure Python files with marimo decorators:

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 references/ directory. Consult these files for comprehensive examples and parameters.

Core
APIReference FileDescription
Markdownreferences/markdown.mdmo.md() for rich text, LaTeX, icons
HTMLreferences/html.mdmo.Html, mo.as_html(), styling
Outputsreferences/outputs.mdmo.output.append(), console redirection
UI Elements
APIReference FileDescription
Inputsreferences/inputs.mdSliders, text, dropdowns, tables, forms, etc.
Layoutsreferences/layouts.mdmo.hstack, mo.vstack, tabs, accordion, etc.
Mediareferences/media.mdImages, audio, video, PDF, downloads
Plottingreferences/plotting.mdAltair, Plotly, matplotlib integration
Diagramsreferences/diagrams.mdMermaid diagrams
Statusreferences/status.mdProgress bars, spinners
Data
APIReference FileDescription
SQLreferences/sql.mdmo.sql() for database and DataFrame queries
Advanced
APIReference FileDescription
Control Flowreferences/control-flow.mdmo.stop(), conditional execution
Statereferences/state.mdmo.state() for UI synchronization
Cachingreferences/caching.md@mo.cache, @mo.persistent_cache
Query Paramsreferences/query-params.mdmo.query_params() for URL state
CLI Argsreferences/cli-args.mdmo.cli_args() for script arguments
Watchreferences/watch.mdmo.watch.file() for reactive file monitoring
Appreferences/app.mdEmbedding notebooks, mo.app_meta()
Cellreferences/cell.mdCross-notebook execution, testing

Quick Examples

Basic UI
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
table = mo.ui.table(df, selection="multi")
table

# In another cell
selected = table.value  # Selected rows as DataFrame
SQL Query
result = mo.sql(f"SELECT * FROM {df} WHERE value > {threshold.value}")
Conditional Execution
mo.stop(form.value is None, mo.md("Submit the form to continue"))
# Rest of cell runs only after form submission

Running as Apps

marimo run notebook.py                    # Local app
marimo export html-wasm notebook.py       # Static WASM app

Layout options: Vertical (default), Grid (drag-drop in editor), Slides.

Best Practices

  • Reactivity: Declare and mutate variables in the same cell
  • Performance: Use @mo.cache for expensive computations
  • UI Gating: Use mo.stop() to prevent expensive ops until ready
  • State: Avoid mo.state() unless synchronizing multiple UI elements
  • Organization: Cell position doesn't matter; organize for readability

Resources

Comments

Markdown supported