.ipynb) and other formats to reactive marimo notebooks.
Convert Command
Themarimo 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:Jupyter Notebooks (.ipynb)
Jupyter Notebooks (.ipynb)
Converts Jupyter notebooks to marimo format:What gets converted:
- Code cells → marimo cells
- Markdown cells →
mo.md()cells - Cell execution order → dependency graph
- All cell outputs (regenerated when you run the notebook)
- Jupyter metadata
- Execution counts
Markdown Files (.md, .qmd)
Markdown Files (.md, .qmd)
Converts markdown files with Python code fences:Requirements:
- Code blocks must use
{python}fence notation:
Python Scripts (.py)
Python Scripts (.py)
Converts Python scripts to marimo notebooks:Supported formats:
- py:percent format (VSCode/PyCharm style):
- Plain scripts: marimo attempts intelligent conversion
Conversion Process
Identify the format
marimo detects the file type by extension:
.ipynb→ Jupyter notebook.mdor.qmd→ Markdown document.py→ Python script
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)
What Gets Converted
Code Cells ✓
Jupyter code cells become marimo cells:Markdown Cells ✓
Markdown becomesmo.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
Manual Adjustments
After conversion, you may need to refactor code that doesn’t fit marimo’s reactive model.Variable Mutations
Side Effects
Minimize global state and side effects:Display Order
Jupyter executes top-to-bottom; marimo executes by dependency:Common Issues
Import Error: jupytext
Import Error: jupytext
Problem: Converting Python scripts fails with missing
jupytext.Solution:Multiple Definition Error
Multiple Definition Error
Problem: Cells redefine the same variable.Solution: Refactor to define each variable in only one cell:
Syntax Errors
Syntax Errors
Problem: File has syntax errors.Solution: Fix syntax errors in the original file before conversion:
Already a marimo Notebook
Already a marimo Notebook
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
| Feature | Jupyter | marimo |
|---|---|---|
| File format | JSON (.ipynb) | Python (.py) |
| Execution | Manual, top-to-bottom | Automatic, reactive |
| Hidden state | Possible | Prevented |
| Version control | Difficult (JSON) | Easy (Python) |
| Reproducibility | Order-dependent | Guaranteed |
| Diffs | Noisy JSON | Clean Python |
| Collaboration | Merge conflicts | Standard Git workflow |
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