Where Have You Been All My Life?
Let me paint you a familiar picture: You’re excited to start a new Python project.
You git clone
that fancy repo and you have to figure out how to install the python environment on your system.
It can consist of installing the right python version, picking the right dependency manager to install everything and waiting 45 minutes for everything to install, only to run into yanked versions, or incompatibilities for your specific config.
Enter uv - Astral’s answer to Python tooling fatigue.
What Exactly is This Magic?
uv is like if pip
, virtualenv
, and pyenv
had a baby raised by Rust.
Created by the same folks behind the wildly popular ruff
linter, it’s essentially:
- 🧩 A unified toolkit replacing half your Python workflow
- 🚀 A dependency resolver that runs at light speed (think 10-100x faster)
- 🔄 Backward-compatible with your existing
requirements.txt
andpyproject.toml
I’ve been using it for a couple of months now, and honestly? Going back would feel like punishment.
Why You’ll Want This in Your Data Science Toolkit
1. “Wait, It Installed Already?” Speed
Let’s get real - we’ve all used install time to make coffee. With uv, that coffee break turns into a sip. I’ve benchmarked the install times for pip
and uv
for the repo with notebooks for our Python Polars book, and these are the results:
For a cold install (where the package managers have to download everything) pip takes 154 seconds, while uv takes 6 seconds. For a warm install (where all packages are in cache) pip takes 102 seconds, while uv takes 29 miliseconds.
That’s what a smart structure combined with Rust’s parallelism and smarter dependency resolution can get you.
2. Environment Ready To Go
Much like poetry
, uv
works with lockfiles.
In these files the specific versions are saved so that you can test that everything works in that specific configuration.
But on top of that uv
also takes care of you having the right python version to run everything with.
This makes one uv sync
the only command you run to get up and running.
3. Python Version Juggling Made Simple
Remember that time numpy
broke because someone used Python 3.12 too early? uv
’s Python management is smoother than a barista’s latte art:
uv python install 3.13.1 # Gets the exact version you need
# or
uv venv --python 3.13 # Creates environment with it
No more pyenv
/conda
conflicts or trouble getting the right version on your system.
Getting Started: A Human-Friendly Guide
I’d recommend installing it on your system, as it’s a tool you’ll use. Not a dependency for the project your working on. If you’re on macOS/Linux:
# One-line install - the good kind of magic
curl -LsSf https://astral.sh/uv/install.sh | sh
Or if you’re a Homebrew fanatic:
brew install uv # Because why complicate things?
Other (subpar) ways of installing it are available on the website.
Your First uv Project: No PhD Required
- Start fresh (without the usual circus):
uv init my_project && cd my_project
- Install packages at Ludicrous Speed™:
uv add polars "torch>=2.0"
3a. Set-up virtual environment:
uv sync
source .venv/bin/activate
3b. Run scripts like it’s 3025:
# plot.py
# /// [uv]
# dependencies = ["polars", "plotnine"] # PEP723 annotations FTW
# ///
# Your actual code below...
uv run plot.py
Auto-installs deps into an ephemeral environment and then runs it - chef’s kiss
But Does It Work with [Insert Your Favorite Tool Here]?
Probably! uv plays nice with:
- ✅ GitHub Actions
- ✅ Docker
- ✅ Jupyter notebooks (use
uv run --with jupyterlab jupyter lab
) - ✅ Even legacy
requirements.txt
files - ⛔️ A [tool.poetry] set-up in pyproject.toml (But it’s relatively easy to migrate)
The only thing missing? A “I ❤️ uv” sticker for your laptop. (Astral, if you’re reading this…)
Should You Switch?
Yes if:
- You value your time more than package managers
- You want one tool instead of five
Maybe wait if:
- You’re mid-critical-project (learning curve exists)
- Your project config is a nightmare to migrate
- Your life depends on dependabot support (Coming this quarter!)
uv
isn’t just a tool upgrade - it’s a productivity boost.
My main takeaway from this tool is that performance is, in fact, a feature!
Ultimately that leaves me more time to browse memes, which is, of course, what life is actually about.