Awesome! Figuring out all this packaging stuff is like walking through fog, exploring and never knowing if you will reach the destiny.
But on the path I think I figured out some best practices that I'll use now when working with marimo, that I'll share right here.
- I'll have a global version of marimo installed via
uv tool install marimo
or with a specific python version using
UV_PYTHON=python3.11 uv tool install marimo
(this will overwrite the previous global installation)
Furthermore, the global version of marimo can be updated via
uv tool install marimo --upgrade
.
When I run a script with the global marimo version, I'll do that via
marimo edit hi.py --sandbox
When I run a script that already ran once with a --sandbox flag, I can simply omit this flag and run
marimo edit hi.py
The CLI tell me "This notebook has inlined package dependencies.
Run in a sandboxed venv containing this notebook's dependencies? [Y/n]" and I'll press "Enter" to continue
Now, when I don't want to use the global marimo, but a temporary marimo version instead, I'll run
uvx marimo edit --sandbox hi.py
this line is 100% identical to
uv tool run marimo edit --sandbox hi.py
because "uvx" is an alias to "uv tool run".
I can also specify a python version here, like this
uvx --python 3.13 marimo edit hi.py
The thing about uvx marimo is the following: It's not installed, it's just cached.
Runing
uv cache clean
will remove all artifacts from my system that were cached with uvx before.
Another option is to work with a virtual environment using uv:
uv venv
uv pip install marimo
uv run marimo edit hi.py
this venv can also be activated via
source .venv/bin/activate
and then marimo can be started via
marimo edit hi.py
.
And always, if I'm not sure what marimo installation I'm currently using, I can run
which marimo
and it will show me the file path.