Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

755 B
Raw Blame

Python script

Export marimo notebooks to flat Python scripts.

Export from the marimo editor

You can download your notebook as a Python script from the notebook menu in the editor: choose "Export…", then the "Python" format and "Flat script".

Export from the command line

Export to a flat Python script in topological order.

marimo export script notebook.py -o notebook.script.py

!!! warning "Top-level await not supported"

Exporting to a flat Python script does not support top-level await. If you have
top-level await in your notebook, you can still execute the notebook as a
script with `python notebook.py`.

You can then reuse the notebook as a script or a module.