Appendix A. Setting up your environment with uv and marimo
This book uses two modern tools for working with Python:
- uv for managing Python environments and dependencies
- Marimo for interactive, notebook-style code
If you’ve used pip or Conda and Jupyter notebooks, this appendix will help you transition smoothly.
Why these tools
Before jumping in, let’s briefly discuss our motivations.
- uv replaces pip, virtualenv, and much of Conda for Python-only workflows. It is fast and produces fully reproducible environments.
- Marimo replaces Jupyter notebooks with a reactive model that eliminates hidden state and out-of-order execution bugs.
Overall, these tools aim to make setting up and running our code fast, reproducible, and stress-free.
Installing uv
Run the following command in your terminal if your system is Linux or macOS:
curl -LsSf https://astral.sh/uv/install.sh | sh
For Windows, run the following PowerShell command:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
After this, restart your terminal or reload your shell configuration. Verify a successful installation with:
uv --version
If this prints a version number, you’re good to go. If not, you might need to add uv to your system PATH. For example, as uv is installed at .local/bin on my macOS system,
export PATH="$HOME/.local/bin:$PATH"
Setting up the project environment
If you don’t have the accompanying code, use Git to clone the repository with the command: