Skip to main content

Build and publish python packages from marimo notebooks

Project description

marimo-dev

Build Python packages from Marimo notebooks.

Quick start

uv init --lib my-project
cd my-project
uv add marimo marimo-dev
mkdir notebooks

Create notebooks/a_core.py:

import marimo
app = marimo.App()

@app.function
def greet(name:str="World"):
    "Return a greeting"
    return f"Hello, {name}!"

Build and publish:

md build
md publish --test

How it works

marimo-dev extracts self-contained functions and classes from your notebooks and writes them to clean Python modules. It generates __init__.py with proper exports and creates llms.txt API documentation.

Project structure

my-project/
├── pyproject.toml
├── notebooks/
│   ├── a_core.py      # letter prefix avoids import collisions
│   ├── b_utils.py
│   └── XX_draft.py    # XX_ prefix = ignored
├── src/               # generated
│   └── my_project/
│       ├── __init__.py 
│       ├── core.py    # prefix stripped
│       └── utils.py
└── docs/              # generated
    └── llms.txt

Module naming

Prefix notebooks with letters (a_, b_, c_) to avoid import collisions during development. The prefix is stripped in the built package.

In notebooks, import from other notebooks directly:

from a_core import greet

marimo-dev rewrites these to relative imports in the built package:

from .core import greet

Configuration

Add to pyproject.toml:

[tool.marimo-dev]
nbs = "notebooks"           # notebook directory
out = "src"                 # output directory
docs = "docs"               # docs directory
decorators = ["app.function", "app.class_definition"]
skip_prefixes = ["XX_", "test_"]

All settings are optional. Defaults shown above.

Hash pipes

Control exports and documentation with directives:

@app.function
#| nodoc
def helper(): pass         # exported but not documented

@app.function
#| internal
def _internal(): pass      # not exported to __all__

@app.function
#| nodoc internal
def _helper(): pass        # neither exported nor documented

Documentation style

Use fastcore.docments style for best results:

@app.function
def add(
    a:int, # first number
    b:int, # second number
)->int:    # sum
    "Add two numbers"
    return a + b

Comments become inline parameter documentation in llms.txt.

Commands

md build              # build package
md publish --test     # publish to Test PyPI
md publish            # publish to PyPI
md tidy               # remove cache files
md nuke               # remove all build artifacts

Requirements

Python 3.12+, marimo, uv

Tips

  • Let marimo manage dependencies through its package tab
  • Update version manually in pyproject.toml before publishing
  • Use uv sync --upgrade to update all dependencies
  • Use uv cache clean for troubleshooting
  • To test built code during development, add pythonpath = ["src"] to [tool.marimo.runtime] in pyproject.toml

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

marimo_dev-0.1.12.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

marimo_dev-0.1.12-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file marimo_dev-0.1.12.tar.gz.

File metadata

  • Download URL: marimo_dev-0.1.12.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux ARM","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for marimo_dev-0.1.12.tar.gz
Algorithm Hash digest
SHA256 407ea021acbb584241d0b02f0b727bef0643d753164ed284c9ef49d2175c6540
MD5 1289416a626f6459266beedb569a7acb
BLAKE2b-256 c7cb4a8874ad91fbc0a36cddaabfd509e330ab8e0fc83669f884875be0a834b5

See more details on using hashes here.

File details

Details for the file marimo_dev-0.1.12-py3-none-any.whl.

File metadata

  • Download URL: marimo_dev-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux ARM","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for marimo_dev-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 c87e1efc8810e237dc6561bda868683aac7713260c85f5b5bb499f4e73a74e2f
MD5 eab0d0a9cc63d614aaad40a59972d3bd
BLAKE2b-256 c9a88a704e20cf58dfd86994b41700e2c0bec3d7d711819622aa9971328b82eb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page