A JupyterLab extension to open Marimo files in an embbeded Marimo editor
Project description
JupyterLab Marimo Extension
A JupyterLab extension that automatically opens Marimo notebooks in the Marimo editor instead of the default text editor or notebook interface.
Features
- Automatic File Type Registration: Registers
.mo.pyfiles as a custom file type in JupyterLab - Seamless Integration: Double-click
.mo.pyfiles 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.pyfiles 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
-
Clone or create the extension directory:
cd marimo-jupyterlab-extension
-
Install Python dependencies:
uv sync --extra dev
-
Install JavaScript dependencies:
uv run jlpm install
-
Build the extension:
uv run jlpm build
-
Install the extension in development mode:
uv run jupyter labextension develop . --overwrite
-
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
-
Open JupyterLab:
jupyter lab -
Create or navigate to a
.mo.pyfile:- Create a new file with the
.mo.pyextension - Or navigate to an existing Marimo notebook
- Create a new file with the
-
Open the file:
- Double-click the
.mo.pyfile in the file browser - Or right-click and select "Open in Marimo"
- Double-click the
-
The Marimo editor will open in an embedded iframe within JupyterLab
How It Works
The extension:
- Registers
.mo.pyas a custom file type in JupyterLab - Creates a custom widget factory that handles
.mo.pyfiles - Embeds the Marimo editor in an iframe using the
jupyter-marimo-proxyservice - Constructs a proxied URL in the format:
/marimo/?file=<path> - Passes the file path to Marimo for editing
Troubleshooting
Extension Not Loading
If the extension doesn't appear to be working:
-
Check that the extension is installed:
jupyter labextension list
You should see
marimo-jupyterlab-extensionin the list. -
Rebuild JupyterLab:
jupyter lab build
-
Clear browser cache and restart JupyterLab
Marimo Proxy Not Available
If you see an error about the Marimo proxy not being available:
-
Verify Marimo is installed:
pip show marimo
-
Verify jupyter-server-proxy is installed:
pip show jupyter-server-proxy
-
Check that the proxy is running:
- Open your browser's developer console (F12)
- Look for any network errors related to
/marimo/
-
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.pyextension
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 editorMarimoEditorFactory: 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:
-
Update version in
package.json:{ "version": "0.2.0" }
-
Clean and build:
uv run jlpm clean:all rm -rf dist build *.egg-info uv build
-
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a93537345c4f9a8d2964310b99ea5cee6217a3f92991a10485e4d6913eac2fba
|
|
| MD5 |
415a4d35974fa6b6d22ec6f601315b87
|
|
| BLAKE2b-256 |
0221f269fdd67bab5748ef9ff69e0dfcd8d23f962ce9cff48dbc822f2d896088
|
File details
Details for the file jupyterlab_marimo-0.1.1-py3-none-any.whl.
File metadata
- Download URL: jupyterlab_marimo-0.1.1-py3-none-any.whl
- Upload date:
- Size: 45.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18da0805fc4b15ca82cff011f6a768ba30cbd981595414a675571d5624dadb6c
|
|
| MD5 |
351f87f6de49a676dbeef5640e2b496c
|
|
| BLAKE2b-256 |
3cf8817a437a9ef6c1cdbe272619d724a01585bbb790a3f655cf17d18ec3b027
|