Skip to main content
marimo provides tools to convert Jupyter notebooks (.ipynb) and other formats to reactive marimo notebooks.

Convert Command

The marimo convert command transforms various formats into marimo notebooks.

Basic Conversion

After conversion, open the notebook with:

Supported Formats

marimo can convert from multiple source formats:
Converts Jupyter notebooks to marimo format:
What gets converted:
  • Code cells → marimo cells
  • Markdown cells → mo.md() cells
  • Cell execution order → dependency graph
What gets stripped:
  • All cell outputs (regenerated when you run the notebook)
  • Jupyter metadata
  • Execution counts
Converts markdown files with Python code fences:
Requirements:
  • Code blocks must use {python} fence notation:
Converts Python scripts to marimo notebooks:
Supported formats:
  • py:percent format (VSCode/PyCharm style):
  • Plain scripts: marimo attempts intelligent conversion
Requires jupytext for script conversion:

Conversion Process

1

Identify the format

marimo detects the file type by extension:
  • .ipynb → Jupyter notebook
  • .md or .qmd → Markdown document
  • .py → Python script
2

Parse the content

Extract code cells, markdown, and dependencies:
  • Jupyter: Reads notebook JSON structure
  • Markdown: Parses {python} code fences
  • Scripts: Identifies cell boundaries (requires jupytext)
3

Build dependency graph

marimo analyzes variable usage to create the reactive graph:
4

Generate marimo notebook

Creates a .py file with marimo’s structure:

What Gets Converted

Code Cells ✓

Jupyter code cells become marimo cells:

Markdown Cells ✓

Markdown becomes mo.md() calls:

Cell Outputs ✗

Outputs are NOT preserved:
  • Plots, tables, and text outputs are stripped
  • Re-run the notebook to regenerate outputs
  • This ensures fresh, reproducible results
marimo’s reactivity means outputs update automatically as you edit - no need to manually re-run cells!

Manual Adjustments

After conversion, you may need to refactor code that doesn’t fit marimo’s reactive model.

Variable Mutations

marimo doesn’t allow multiple cells to define the same variable.

Side Effects

Minimize global state and side effects:

Display Order

Jupyter executes top-to-bottom; marimo executes by dependency:

Common Issues

Problem: Converting Python scripts fails with missing jupytext.Solution:
Problem: Cells redefine the same variable.Solution: Refactor to define each variable in only one cell:
Problem: File has syntax errors.Solution: Fix syntax errors in the original file before conversion:
Problem: File is already in marimo format.Solution: No conversion needed! Just open it:

Conversion Checklist

After converting, verify these items:
  • All cells execute without errors
  • No multiple definitions of the same variable
  • Dependencies are correctly detected
  • Markdown cells render properly
  • Imports are in the first cell
  • No hidden state or global mutations
  • Outputs regenerate correctly

Remote Notebooks

Convert notebooks hosted on GitHub:

Batch Conversion

Convert multiple notebooks:

Comparing with Jupyter

Why Convert?

Better Version Control

Plain Python files are easier to diff, merge, and review.

Reproducibility

marimo’s reactivity eliminates hidden state issues.

Interactivity

Built-in UI elements without writing JavaScript.

Deployment

Run as scripts, apps, or export to multiple formats.

Next Steps

Creating Notebooks

Learn marimo’s cell structure

Package Management

Add dependencies to your notebooks