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.1.tar.gz (102.8 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.1-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for sphinx_marimo-0.2.1.tar.gz
Algorithm Hash digest
SHA256 42ce6399d68ba24da38f82536b96e9d3f6fbb43175ac341530db23a554b3d50f
MD5 ce2018a018299037d157c469255a459e
BLAKE2b-256 3a809c077486421b27384bd983ed5c0ad040d2d0c38026e176373f97f87c940d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sphinx_marimo-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aa903831b04181aa5e5623ff7dd8bd7609daddc773f534fa5c325624c7facd4d
MD5 9ed21d044758aa7856eceb71a8a276ad
BLAKE2b-256 00a5f0ffd8066e1277dee2e6b0852ee53682126426970ba456f62d6aa1b6bb7a

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