Skip to main content

Build and publish python packages from marimo notebooks

Project description

marimo_dev

A literate programming build system that converts Marimo notebooks into distributable Python packages. Inspired by nbdev.

What it does

Looks in /notebooks dir for self contained functions and classes and extracts them into a PyPI ready directory. Each notebook will be striped of the leading ##_, and XX_ and test notebooks will be ignored. Run md build to generate a proper Python package with __init__.py, module files, and llms.txt API documentation.

What it does not

An intentional effort to minimise magic project set up. You are responsible for setting up your pyproject.toml, and even mkdir notebooks. Note: I highly reccommend that you use uv my main motivation for making this was the dependency harmony betwwen marimo and uv

Project structure

my-project/
├── README.md
├── pyproject.toml
├── notebooks/
│   ├── 01_core.py
│   ├── 02_read.py
│   ├── ...
├── src/                 # auto created
│   └── my_package/
│       ├── __init__.py 
│       ├── core.py    
│       ├── read.py
│       └── ...
├── docs/                # auto created
│   ├── index.html       # Fut ver. 0.2
│   └── llms.txt
└── dist/                # auto created
    └──...

How it works

The build system parses notebooks via AST, extracts decorated exports (@app.function, @app.class_definition), and writes clean module files. It reads metadata from pyproject.toml and generates __init__.py with proper imports and __all__ exports.

The llms.txt file contains function signatures with inline documentation extracted from comments, formatted for LLM consumption. This provides a compact API reference. Note: this will work much better with fastcore.docments style function definitions

CLI usage

md build              # build package from notebooks/
md publish            # publish to PyPI
md publish --test     # publish to Test PyPI

Requirements

  • Python 3.12+, Marimo, uv, pyproject.toml
    • for relative imports to work in multi module libraries add the following to your pyproject.tml
    • </code></pre>
      </li>
      </ul>
      pythonpath = ["src"]  ```</li>
      </ul>
      <p><strong>Tip</strong> <em>let marimo manages your <code>pyproject.toml</code> through its package tab, making dependencies visible and easy to update. When you add packages and remove them from the marimo package tab marimo will automaticly update your pyproject.toml</em></p>
      <h2>Install</h2>
      <pre lang="bash"><code>uv add marimo-dev
      

      Helpful

      uv sync --upgrade` # to update uv.lock and pyroject.toml in one go...
      uv cache clean     # General Trouble Shooting Tip
      
      • you need to manually update the version in pyproject.toml

      Module structure

      • core.py - Data model: Kind, Param, Node
      • read.py - Parse notebooks, extract exports, scan project
      • pkg.py - Write module files and __init__.py
      • docs.py - Generate signatures and llms.txt
      • build.py - Orchestrate the build
      • cli.py - Command-line interface

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.2.tar.gz (7.3 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.2-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: marimo_dev-0.1.2.tar.gz
  • Upload date:
  • Size: 7.3 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.2.tar.gz
Algorithm Hash digest
SHA256 bac02422243f3327f30e5de925ad2e20e7d5c0ec37b7f4abf54f77a7bd1f2e5f
MD5 d7d2e536c8b92f4b524f7471dca28890
BLAKE2b-256 984f22e0aed7914e4b2731cbefb476a54f1f9b5df1956a612fece4d73534b3c4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: marimo_dev-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.2 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fc239898ef1c5222d71fa0be7e436609456886cc4880edc805f20a7a630890d5
MD5 c8c49f486c6faaf71abdc98634d3538f
BLAKE2b-256 8d24bec7438254ca5622c1073c175ffafefa655e069de33922b5f3daa5382ef2

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