Skip to main content

JupyterLab Marimo Extension

A JupyterLab extension that automatically opens Marimo notebooks in the Marimo editor instead of the default text editor or notebook interface.

JupyterLab Marimo Extension

Features

  • Automatic File Type Registration: Registers .mo.py files as a custom file type in JupyterLab
  • Seamless Integration: Double-click .mo.py files in the file browser to open them directly in Marimo
  • Embedded Editor: Displays the Marimo editor in an iframe within JupyterLab
  • Error Handling: Provides clear error messages if Marimo or the proxy is not available
  • Context Menu: Right-click on .mo.py files to open them in Marimo

Installation

User Installation (from PyPI)

Install the extension with a single command:

pip install jupyterlab-marimo

Or with uv:

uv pip install jupyterlab-marimo

This will automatically install all dependencies including:

  • Marimo (>= 0.6.21)
  • jupyter-server-proxy
  • JupyterLab extension files

Then start JupyterLab:

jupyter lab

The extension will be automatically enabled!

Development Installation

  1. Clone or create the extension directory:

    cd marimo-jupyterlab-extension
    
  2. Install Python dependencies:

    uv sync --extra dev
    
  3. Install JavaScript dependencies:

    uv run jlpm install
    
  4. Build the extension:

    uv run jlpm build
    
  5. Install the extension in development mode:

    uv run jupyter labextension develop . --overwrite
    
  6. Start JupyterLab:

    jupyter lab
    

Watch Mode (for Development)

To automatically rebuild the extension when you make changes:

uv run jlpm watch

In another terminal, run JupyterLab with watch mode:

jupyter lab --watch

Usage

  1. Open JupyterLab:

    jupyter lab
    
  2. Create or navigate to a .mo.py file:

    • Create a new file with the .mo.py extension
    • Or navigate to an existing Marimo notebook
  3. Open the file:

    • Double-click the .mo.py file in the file browser
    • Or right-click and select "Open in Marimo"
  4. The Marimo editor will open in an embedded iframe within JupyterLab

How It Works

The extension:

  1. Registers .mo.py as a custom file type in JupyterLab
  2. Creates a custom widget factory that handles .mo.py files
  3. Embeds the Marimo editor in an iframe using the jupyter-marimo-proxy service
  4. Constructs a proxied URL in the format: /marimo/?file=<path>
  5. Passes the file path to Marimo for editing

Troubleshooting

Extension Not Loading

If the extension doesn't appear to be working:

  1. Check that the extension is installed:

    jupyter labextension list
    

    You should see marimo-jupyterlab-extension in the list.

  2. Rebuild JupyterLab:

    jupyter lab build
    
  3. Clear browser cache and restart JupyterLab

Marimo Proxy Not Available

If you see an error about the Marimo proxy not being available:

  1. Verify Marimo is installed:

    pip show marimo
    
  2. Verify jupyter-server-proxy is installed:

    pip show jupyter-server-proxy
    
  3. Check that the proxy is running:

    • Open your browser's developer console (F12)
    • Look for any network errors related to /marimo/
  4. Restart JupyterLab after installing dependencies

File Path Issues

If the file doesn't open correctly:

  • Ensure the file path is correct and the file exists
  • Check the browser console for detailed error messages
  • Verify that the file has the .mo.py extension

Alternative URL Patterns

The extension tries to use the URL pattern /marimo/?file=<path>. If your jupyter-marimo-proxy configuration uses a different pattern, you may need to modify the URL construction in src/index.ts (line ~70).

Common patterns:

  • /marimo/?file=<path> (default)
  • /marimo/edit?file=<path>
  • /proxy/absolute/<port>/marimo/edit?file=<path>

Uninstallation

If you installed from PyPI:

pip uninstall jupyterlab-marimo

If you installed in development mode:

jupyter labextension develop --uninstall .

Development

Project Structure

marimo-jupyterlab-extension/
├── package.json          # Node.js dependencies and scripts
├── tsconfig.json         # TypeScript configuration
├── src/
│   └── index.ts         # Main extension code
├── style/
│   ├── index.css        # Extension styles
│   └── index.js         # Style module entry
└── README.md            # This file

Key Files

  • src/index.ts: Contains the main plugin logic, including:

    • MarimoEditorWidget: The widget that embeds the Marimo editor
    • MarimoEditorFactory: Factory for creating Marimo editor widgets
    • Plugin registration and activation
  • style/index.css: Styles for the Marimo editor widget

Building

# Build the extension
uv run jlpm build

# Build for production (no source maps)
uv run jlpm build:prod

# Clean build artifacts
uv run jlpm clean

Publishing (for Maintainers)

To publish a new version to PyPI:

  1. Update version in package.json:

    {
      "version": "0.2.0"
    }
    
  2. Clean and build:

    uv run jlpm clean:all
    rm -rf dist build *.egg-info
    uv build
    
  3. Publish to PyPI:

    uv publish
    

That's it! The Python package includes everything (JavaScript, labextension, dependencies). Users only need to pip install jupyterlab-marimo.

Note: The JavaScript/labextension is automatically built and bundled into the Python package via the hatch-jupyter-builder hooks in pyproject.toml. No npm account needed!

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

License

Apache-2.0

Credits

This extension is designed to work with:

  • Marimo - A reactive Python notebook

This extension includes code borrowed from:

  • jupyter-marimo-proxy by Jiang Yio - Jupyter server proxy configuration for Marimo (Apache-2.0 license)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupyterlab_marimo-0.1.1.tar.gz (797.9 kB view details)

Uploaded Source

Built Distribution

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

jupyterlab_marimo-0.1.1-py3-none-any.whl (45.7 kB view details)

Uploaded Python 3

File details

Details for the file jupyterlab_marimo-0.1.1.tar.gz.

File metadata

  • Download URL: jupyterlab_marimo-0.1.1.tar.gz
  • Upload date:
  • Size: 797.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.16

File hashes

Hashes for jupyterlab_marimo-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a93537345c4f9a8d2964310b99ea5cee6217a3f92991a10485e4d6913eac2fba
MD5 415a4d35974fa6b6d22ec6f601315b87
BLAKE2b-256 0221f269fdd67bab5748ef9ff69e0dfcd8d23f962ce9cff48dbc822f2d896088

See more details on using hashes here.

File details

Details for the file jupyterlab_marimo-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyterlab_marimo-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 18da0805fc4b15ca82cff011f6a768ba30cbd981595414a675571d5624dadb6c
MD5 351f87f6de49a676dbeef5640e2b496c
BLAKE2b-256 3cf8817a437a9ef6c1cdbe272619d724a01585bbb790a3f655cf17d18ec3b027

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page