Marimushka is a powerful tool for exporting marimo notebooks to HTML/WebAssembly format with custom styling. It helps you create beautiful, interactive web versions of your marimo notebooks and applications that can be shared with others or deployed to static hosting services like GitHub Pages.
Marimushka "exports" your marimo notebooks in a stylish, customizable HTML template, making them accessible to anyone with a web browser - no Python installation required!
- π Export marimo notebooks (.py files) to HTML/WebAssembly format
- π¨ Customize the output using Jinja2 templates
- π± Support for both interactive notebooks and standalone applications
- Notebooks are exported in "edit" mode, allowing code modification
- Apps are exported in "run" mode with hidden code for a clean interface
- π Generate an index page that lists all your notebooks and apps
- π Integrate with GitHub Actions for automated deployment
- π Recursive directory scanning to find all notebooks in a project
- π§© Flexible configuration with command-line options and Python API
- Python 3.10+
- marimo (installed automatically as a dependency)
- uvx (recommended to bypass installation)
We do not recommend installing the tool locally. Please use
# install marimushka on the fly
uvx marimushka
# or
uvx marimushka --help# Basic usage (some help is displayed)
uvx marimushka
# Start exporting, get some help first
uvx marimushka export --help
# Do it
uvx marimushka export
# Specify a custom template
uvx marimushka export --template path/to/template.html.j2
# Specify a custom output directory
uvx marimushka export --output my_site
# Specify custom notebook and app directories
uvx marimushka export --notebooks path/to/notebooks --apps path/to/apps
# Disable sandbox mode (use project environment)
uvx marimushka export --no-sandboxMarimushka recommends your project to have the following structure to be aligned with its default arguments. However, it is possible to inject alternative locations
your-project/
βββ notebooks/ # Static marimo notebooks (.py files)
βββ notebooks_wasm/ # Interactive marimo notebooks (.py files)
βββ apps/ # Marimo applications (.py files)
βββ templates/ # Optional: Custom templates for export
βββ custom.html.j2 # Default template locationBy default, marimushka exports notebooks using the --sandbox flag.
This ensures that the export process runs in an isolated environment, which is safer and ensures that your notebook's dependencies are correctly defined in the notebook itself (e.g. using /// script metadata).
When developing or testing notebooks locally, it is good practice to use the --sandbox flag:
# Running a notebook with the sandbox flag
marimo run your_notebook.py --sandbox
# Or with uvx
uvx marimo run your_notebook.py --sandboxIf you need to export notebooks that rely on the local environment (e.g. packages installed in the current venv but not declared in the notebook), you can disable the sandbox:
uvx marimushka export --no-sandboxYou can use marimushka in your GitHub Actions workflow to automatically export and deploy your notebooks:
permissions:
contents: read
jobs:
export:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Export marimo notebooks
uses: jebel-quant/marimushka@v0.2.1
with:
template: 'path/to/template.html.j2' # Optional: custom template
notebooks: 'notebooks' # Optional: notebooks directory
apps: 'apps' # Optional: apps directory
notebooks_wasm: 'notebooks' # Optional: interactive notebooks directoryThe action will create a GitHub artifact named 'marimushka' containing all exported files. The artifact is available in all jobs further declaring a dependency on the 'export' job.
| Input | Description | Required | Default |
|---|---|---|---|
notebooks |
Directory containing marimo notebook files (.py) to be exported as static HTML notebooks. | No | notebooks |
apps |
Directory containing marimo app files (.py) to be exported as WebAssembly applications with hidden code (run mode). | No | apps |
notebooks_wasm |
Directory containing marimo notebook files (.py) to be exported as interactive WebAssembly notebooks with editable code (edit mode). | No | notebooks |
template |
Path to a custom Jinja2 template file (.html.j2) for the index page. If not provided, the default Tailwind CSS template will be used. | No |
name: Export and Deploy
on:
push:
branches: [ main ]
jobs:
export-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Export marimo notebooks
uses: jebel-quant/marimushka@v0.2.1
with:
notebooks: 'notebooks'
apps: 'apps'
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: artifacts/marimushka
branch: gh-pagesMarimushka uses Jinja2 templates to generate the 'index.html' file. You can customize the appearance of the index page by creating your own template.
The template has access to two variables:
notebooks: A list of Notebook objects representing regular notebooksapps: A list of Notebook objects representing app notebooksnotebooks_wasm: A list of Notebook objects representing interactive notebooks
Each Notebook object has the following properties:
display_name: The display name of the notebook (derived from the filename)html_path: The path to the exported HTML filepath: The original path to the notebook filekind: The type of the notebook (notebook / apps / notebook_wasm )
Example template structure:
<!DOCTYPE html>
<html>
<head>
<title>My Marimo Notebooks</title>
<style>
/* Your custom CSS here */
</style>
</head>
<body>
<h1>My Notebooks</h1>
{% if notebooks %}
<h2>Interactive Notebooks</h2>
<ul>
{% for notebook in notebooks %}
<li>
<a href="{{ notebook.html_path }}">{{ notebook.display_name }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% if apps %}
<h2>Applications</h2>
<ul>
{% for app in apps %}
<li>
<a href="{{ app.html_path }}">{{ app.display_name }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
</body>
</html>Contributions are welcome! Here's how you can contribute:
- π΄ Fork the repository
- πΏ Create your feature branch (
git checkout -b feature/amazing-feature) - πΎ Commit your changes (
git commit -m 'Add some amazing feature') - π’ Push to the branch (
git push origin feature/amazing-feature) - π Open a Pull Request
# Clone the repository
git clone https://github.com/jebel-quant/marimushka.git
cd marimushka
# Install dependencies
make install
# Run tests
make test
# Run linting and formatting
make fmtThis project is licensed under the MIT License.