Skip to main content

Sphinx extension for embedding Marimo notebooks with WASM support

Project description

sphinx-marimo

A Sphinx extension for embedding interactive Marimo notebooks in documentation with WASM support, similar to Jupyter-Lite.

Features

  • Zero-config WASM deployment - Notebooks run entirely in the browser
  • Seamless Sphinx integration - Works with any Sphinx theme
  • 🚀 Interactive notebooks - Full Marimo interactivity in your docs
  • 🚀 Build-time compilation - Notebooks are compiled to WASM during docs build
  • Static site compatible - Works with GitHub Pages, Read the Docs, etc.
  • 🎨 Sphinx Gallery integration - Automatically adds "launch marimo" buttons to Gallery examples

Installation

Using uv (recommended):

uv add sphinx-marimo

Or using pip:

pip install sphinx-marimo

Quick Start

  1. Add the extension to your conf.py:
extensions = [
    'sphinx_marimo',
    # ... other extensions
]

# Optional configuration
marimo_notebook_dir = 'notebooks'  # Directory containing .py Marimo notebooks
marimo_default_height = '600px'
marimo_default_width = '100%'
  1. Create a Marimo notebook (.py file):
import marimo

__generated_with = "0.1.0"
app = marimo.App()

@app.cell
def __():
    import marimo as mo
    return mo,

@app.cell
def __(mo):
    slider = mo.ui.slider(1, 10, value=5)
    mo.md(f"Value: {slider.value}")
    return slider,
  1. Embed it in your documentation:
.. marimo:: path/to/notebook.py
   :height: 800px
   :width: 100%

Sphinx Gallery Integration

The extension automatically detects Sphinx Gallery and adds "launch marimo" buttons:

# In conf.py
extensions = [
    'sphinx_gallery.gen_gallery',  # Must come before sphinx_marimo
    'sphinx_marimo',
]

sphinx_gallery_conf = {
    'examples_dirs': '../gallery_examples',
    'gallery_dirs': 'auto_examples',
}

# Customize button text (optional)
marimo_gallery_button_text = 'launch marimo'

Gallery examples will automatically include red "launch marimo" buttons alongside existing Binder/JupyterLite buttons.

Architecture

The extension works by:

  1. Build Phase: Converting Marimo .py notebooks to WASM during Sphinx build
  2. Runtime: Serving notebooks as static files that run in the browser
  3. Gallery Integration: Converting Gallery-generated .ipynb files to Marimo WASM
  4. UI Integration: Injecting launcher buttons into Gallery pages

Examples

See the documentation for live examples and full usage guide.

Requirements

  • Python 3.8+
  • Sphinx 4.0+
  • Marimo 0.1.0+
  • For Gallery integration: sphinx-gallery 0.10+

Development

git clone https://github.com/your-repo/sphinx-marimo
cd sphinx-marimo
uv venv
uv pip install -e .

License

MIT License - see LICENSE file for details.

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

sphinx_marimo-0.2.2.tar.gz (103.6 kB view details)

Uploaded Source

Built Distribution

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

sphinx_marimo-0.2.2-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_marimo-0.2.2.tar.gz.

File metadata

  • Download URL: sphinx_marimo-0.2.2.tar.gz
  • Upload date:
  • Size: 103.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.13

File hashes

Hashes for sphinx_marimo-0.2.2.tar.gz
Algorithm Hash digest
SHA256 aae21e5ff97c20ba8632c34db5cf0949910f6f48ba1c6ac4e3c4740066bc8d9e
MD5 5579c29f0a686ba8e74b3ddbf1569a48
BLAKE2b-256 00deba240534181d74e9081e9b250966f5af53ceb05695d776a5e1ea4a5557ce

See more details on using hashes here.

File details

Details for the file sphinx_marimo-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_marimo-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6f642f7595089b3474b623809d7e27d8bc0c73ca86b786fce2053c027eed86da
MD5 147825df9b7680f4c384958988ba7942
BLAKE2b-256 caabf2820e90ac6b7c5ccbc8fc4f4135e79384632832d7a3493f82e580561276

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