If you are a Python developer, you are likely familiar with the fragmented ecosystem of tooling. You use pip for installing packages, venv or virtualenv for environments, pyenv for managing Python versions, and maybe poetry or pip-tools for dependency resolution. It’s a lot to manage.
Enter uv.
Created by Astral (the team behind Ruff), uv is an extremely fast Python package and project manager written in Rust. It’s designed to be a drop-in replacement for pip and pip-tools, but it has evolved into a full-fledged project manager that challenges poetry and pdm.
In this post, I’ll explain why uv is a game-changer and why you should consider switching today.
Why uv is a Game Changer
1. Blazing Speed
Yup, it is freaking fast. In many benchmarks, uv is 10-100x faster than pip-tools or poetry for resolution.
2. Unified Toolchain
uv consolidates multiple tools into one. You no longer need separate tools for:
- Package Installation (
pip) - Environment Management (
venv,virtualenv) - Python Version Management (
pyenv) - Dependency Locking (
pip-compile,poetry lock) - Script Running (
pipx)
You can do it all with a single binary.
3. Automatic Python Version Management
This is my favorite feature. If a project requires Python 3.12 but you only have 3.11 installed, tools like poetry will complain. You’d have to go to pyenv, install 3.12, and then tell poetry to use it.
With uv, you just define the required python version in your project. uv will automatically download and install the correct Python version for that project if it’s missing, in an isolated manner (in .venv). No more global Python version conflicts!!
Comparison: uv vs Poetry
If you are currently using Poetry, you might wonder if it’s worth the switch.
| Feature | Poetry | uv |
|---|---|---|
| Language | Python | Rust |
| Speed | Slow (dependency resolution can take minutes) | Instant (sub-second resolution) |
| Python Management | Relies on external tools (pyenv/system) | Built-in (installs Python automatically) |
| Standards | Uses pyproject.toml (standard) | Uses pyproject.toml (standard) |
| Lock File | poetry.lock | uv.lock (cross-platform) |
The biggest pain point with Poetry has always been the dependency resolver speed. uv solves this completely.
Migrating from requirements.txt
If you have a legacy project using requirements.txt, migrating to uv is EZ. You don’t have to rewrite everything from scratch.
uv supports installing directly from requirements files, and it gives you two ways to do it:
1. Using uv pip (The “pip” way)
If you just want to use uv as a faster pip without changing your workflow:
| |
This installs packages into your current environment exactly like pip install -r requirements.txt, just much faster.
2. Using uv add (The “Project” way)
If you are initializing a new uv project (uv init) and want to import your dependencies:
| |
This reads your requirements.txt and adds the dependencies to your pyproject.toml file, effectively migrating your project management to uv.
Common Commands Cheat Sheet
Here are the commands you will use 90% of the time:
- Initialize a project:
1uv init - Add a dependency:
1uv add requests - Run a script:Note:
1uv run main.pyuv runwill automatically create a virtual environment, install dependencies, and run the script in that isolated environment. - Sync environment:Ensures the virtual environment matches the
1uv syncuv.lockfile.
uv add vs uv pip install
It’s important to understand the difference between these two commands, as uv supports both “project” and “script” workflows.
uv add <package>:- Used for managing a project.
- Updates
pyproject.tomlanduv.lock. - Ensures reproducible builds for your application.
- Similar to
poetry add.
uv pip install <package>:- Used for low-level environment modification.
- Does NOT update
pyproject.toml. - Useful for CI/CD pipelines or ad-hoc environments where you just need packages installed quickly without tracking them.
- Similar to
pip install.
Caveats
While uv is fantastic, it is moving very fast.
- It is relatively new, so edge cases with obscure build backends might still exist.
- If you rely heavily on Poetry plugins,
uvmight not have an equivalent yet.
Conclusion
Give it a try on your next project. You won’t want to go back. At least I won’t. Cheers!