A JupyterLab extension that automatically opens Marimo notebooks in the Marimo editor instead of the default text editor or notebook interface.
- 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
Install the extension with a single command:
pip install jupyterlab-marimoOr with uv:
uv pip install jupyterlab-marimoThis will automatically install all dependencies including:
- Marimo (>= 0.6.21)
- jupyter-server-proxy
- JupyterLab extension files
Then start JupyterLab:
jupyter labThe extension will be automatically enabled!
-
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
To automatically rebuild the extension when you make changes:
uv run jlpm watchIn another terminal, run JupyterLab with watch mode:
jupyter lab --watch-
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
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
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
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
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
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>
If you installed from PyPI:
pip uninstall jupyterlab-marimoIf you installed in development mode:
jupyter labextension develop --uninstall .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
-
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
# Build the extension
uv run jlpm build
# Build for production (no source maps)
uv run jlpm build:prod
# Clean build artifacts
uv run jlpm cleanTo 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!
Contributions are welcome! Please feel free to submit issues or pull requests.
Apache-2.0
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)
