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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for sphinx_marimo-0.2.0.tar.gz
Algorithm Hash digest
SHA256 55b8c33cbdfa12e8b71406ecd9671a19d848eeec222cd004964045b39a7264b4
MD5 eff9034f2f9f131f503ce40a4247156f
BLAKE2b-256 3e7ede21d124f514f45182fcbee0319dc779cba8702c1bfcab0819b4a6c4af5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sphinx_marimo-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59a6faf9ff70529abdd1adba7fdd4aba6107d858b6912e199a1e86778f067d90
MD5 bf0b356d009ff831dfe96da6db710f68
BLAKE2b-256 136e25258ca7c3f0a894fd4d56a0458b152ecdf2031ccb7f48d9c561010f5fa7

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