Skip to main content

marimo-export

Prepare notebook results. Share them anywhere.

Documentation · Getting started · Python API · CLI

PyPI Supported Python versions CI Apache License 2.0

The marimo-export Python package precomputes selected input combinations from a marimo reactive Python notebook and publishes named outputs as a notebook export. Applications and agents read its static files without running Python or receiving the notebook source.

  • Choose the results. Publish named data, tables, charts, rendered cells, and interactive widgets for a finite set of states.
  • Reuse the computation. Reuse prepared states across exports and marimo's native cell cache when a new state needs to run.
  • Verify what you read. Open and verify an export from Python, or read it in the browser with @marimo-team/marimo-export.

Install

Add the package to a Python project with uv:

uv add marimo-export

The package installs the marimo release it pins. Add the optional exporter families selected by your ExportSpec:

uv add "marimo-export[charts,parquet,anywidget]"

The base package supports JSON, native marimo values, and custom exporter callables. charts adds Altair and PNG charts, parquet adds Parquet tables, and anywidget adds AnyWidget bundles. all installs every family.

Quickstart

Create report.py:

import marimo

app = marimo.App()


@app.cell
def _():
    import marimo as mo

    return (mo,)


@app.cell
def _(mo):
    days = mo.ui.slider(1, 30, value=7, label="Days")
    days
    return (days,)


@app.cell
def _(days):
    summary = {"days": days.value, "label": f"Last {days.value} days"}
    summary
    return (summary,)


@app.cell
def _(days, mo, summary):
    report = mo.md(f"## {summary['label']}\n\nSelected window: **{days.value} days**")
    report
    return (report,)


if __name__ == "__main__":
    app.run()

Create report.export.yaml:

schema: marimo-export.spec.v2
default_state: weekly
states:
  weekly: {}
  monthly:
    days: 30
outputs:
  summary:
    source: { kind: json, selector: summary }
  report:
    source: { kind: output, selector: report }

Build with the CLI

mkdir -p dist
uv run marimo-export build report.py \
  --spec report.export.yaml \
  --output dist/report
uv run marimo-export verify dist/report

build prepares missing states, writes the export, verifies every declared asset, and closes the notebook process it started.

Build from Python

from pathlib import Path

from marimo_export import ExportSpec, build

Path("dist").mkdir(exist_ok=True)
spec = ExportSpec.from_file("report.export.yaml")
result = build("report.py", spec=spec, output="dist/python-report")

print(result.path)

A matching later call with a new destination can reuse the prepared export before notebook startup. Pass replace=True to replace an existing complete destination.

Read the export

from marimo_export import open_export, verify_export

export = open_export("dist/report")
summary = export.state("monthly").output("summary").json()
verified = verify_export("dist/report")

print(dict(summary))
print(verified.states, verified.outputs)
{'days': 30, 'label': 'Last 30 days'}
2 4

Opening validates canonical index.json and leaves asset data lazy. Complete verification reads every declared asset and returns exported-state, state-output-pair, unique-asset, and verified-byte counts. The example has two states and two output names, so verified.outputs is 4.

Verification checks the notebook export against its loaded index.json. The consumer still authenticates the publisher and delivery source.

Capture a live session

After opening report.py in a running marimo server, capture() borrows the named session and returns a leased PreparedExport:

from marimo_export import ExportSpec, capture

spec = ExportSpec.from_file("report.export.yaml")

with capture(
    "http://127.0.0.1:2718",
    session="SESSION_ID",
    spec=spec,
) as prepared:
    prepared.write("dist/report", replace=True)

replace=True replaces the complete destination directory. Keep unrelated application files outside dist/report.

Use marimo-export inspect SERVER to find session IDs. The selected session remains active after capture. The live notebook environment and the client must load the same marimo-export implementation and exporter dependencies.

Use from marimo code mode

marimo discovers the installed agent module through its capability registry:

import marimo._code_mode as cm
import marimo_export.agent as export_agent

print(cm.capabilities()["marimo-export"])
help(export_agent)

help(export_agent) shows the public Python workflow and the installed path to the version-matched Agent Skill. Code can inspect the same resources directly:

skill = export_agent.agent_skill()
print(skill.body)

Learn more

Preparing an export executes notebook code with the notebook environment's file, credential, network, and package access.

Metadata

Release files for marimo-export 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for marimo-export 0.2.2
File Size Uploaded Provenance
marimo_export-0.2.2.tar.gz 289.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for marimo-export 0.2.2
File Interpreter ABI Platform
marimo_export-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 663.4 kB

Release files / marimo_export-0.2.2.tar.gz

Download URL marimo_export-0.2.2.tar.gz
Size 289.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f9918e81bc43f8d9f42a237f21c21e8e42750b02c3fcebe2119c3f1688e4a523
BLAKE2b-256 checksum
How to use checksums
1d5a9348500af87b7f892ae701a1c88de3cc912c5085e6fdb4827f96fce707eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / marimo_export-0.2.2-py3-none-any.whl

Download URL marimo_export-0.2.2-py3-none-any.whl
Size 374.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
05e9ae47b90f3597c947a701f0dbb6063d0483dcd83aba0c3dcd60bf516e4ab5
BLAKE2b-256 checksum
How to use checksums
e214ea239b698b56774b3bc28f74e21f197a267cd932f0f01851b67a26e04bcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for marimo-export 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page