Skip to content
A

External dependencies

Loading the Python runtime…

Part 9 of 10 in Learn marimo.

marimo notebooks are Python scripts. That means you can use Python standards for scripts, including PEP 723 inline metadata, to declare the Python version and packages that a notebook needs.

This notebook starts with a metadata block like this:

# /// script
# requires-python = ">=3.12"
# dependencies = [
# "marimo",
# "wigglystuff==0.5.0",
# ]
# ///

Tools that understand PEP 723 can read this block and create an environment with the right dependencies. The rest of the file remains a regular Python script.

Once a dependency is declared, import it normally in a cell.

Here we’ll use wigglystuff.Slider2D, an anywidget, and wrap it with mo.ui.anywidget so marimo can make it reactive.