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.tomlbefore publishing - Use
uv sync --upgradeto update all dependencies - Use
uv cache cleanfor troubleshooting - To test built code during development, add
pythonpath = ["src"]to[tool.marimo.runtime]inpyproject.toml
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file marimo_dev-0.1.13.tar.gz.
File metadata
- Download URL: marimo_dev-0.1.13.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16e49c1ced99761497ea1fdf9c83fe036a788ddb2c9298e55f2abbf488e6617e
|
|
| MD5 |
4f41e863c985b15352ca7850d257cabe
|
|
| BLAKE2b-256 |
7ec8657c6771824fb6c955950572b8482f2546e11941e2e2b67578195a84cf5d
|
File details
Details for the file marimo_dev-0.1.13-py3-none-any.whl.
File metadata
- Download URL: marimo_dev-0.1.13-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d975a33d833acced3bcf7fcf949be7aae061158f53ac7cdb9c142b4af85b049
|
|
| MD5 |
6b053812e34ca6155834a56f8210145f
|
|
| BLAKE2b-256 |
86e9e2585f38dd1eff3f0358882a20c545bd1911132d8b1d3ea14c998a3b9756
|