uv (Python package manager)
“An extremely fast Python package installer and resolver, written in Rust.” It aims to be the Cargo for python.
Here are some nice things about uv
.
- It is FAST! Most installations are almost instant.
- It is a stand-alone tool and can be installed without Python and Rust. Totally free of the python environment mess.
- It simplifies the virtual environment management because it is just a single binary that replaces virtualenv, pip, and pip-tools.
Workflow
venv + pip
Create a virtual environment in the current directory (inside .venv
).
uv venv
source .venv/bin/activate
Btw, you can automate the activation of virtual environment by using direnv.
Create a requirements.in
file (hopefully it will support generating this or pyproject.toml
soon) that lists high-level package requirements.
pandas
matplotlib
jupyter
# local libraries
-e ./libs/xxxx
Install them directly or create a lock file first (note that this lock file is platform-specific and may not translate into other systems) and then install it.
uv pip install -r requirements.in
uv pip compile requirements.in -o requirements.txt
uv pip install -r requirements.txt
Combine with direnv