Python’s ecosystem is a blessing and a curse. On one hand, it’s ridiculously powerful, but on the other, managing environments and dependencies can be a pain. I’ve gone through just about every possible way to set up a Python environment—venv, pipenv, Poetry, pyenv, conda, even rolling my own Dockerized setups.
But recently, I came across uv, a new tool from the folks who built ruff (one of the fastest Python linters out there), and it immediately caught my interest.
After playing around with it, I have to say: I’m impressed. uv is blazing fast, well thought out, and combines features from several other tools I was using separately. If you’re someone who gets annoyed at how long Python dependency installation takes, you might want to give uv a try.
What is uv?
At its core, uv is an extremely fast package manager, project manager, and Python version manager. It’s written in Rust, which explains why it’s absurdly quick compared to pip and Poetry.
But it’s not just a package installer— uv aims to replace a bunch of tools in the Python ecosystem:
- pip & pip-tools → Installs and syncs dependencies
- pipx → Runs Python CLI tools in isolated environments
- Poetry → Manages dependencies and lockfiles
- pyenv → Installs and manages Python versions
- virtualenv → Handles virtual environments
- twine → Publishes packages
So instead of juggling 4+ tools, uv tries to do it all in one go. And so far, it does a good job of it.
Why You Might Want to Use uv
Before I jump into installation and usage, let’s quickly go over why you might even care about switching to uv.
- It’s ridiculously fast. Installing dependencies with uv is 10x-100x faster than pip. Yes, seriously. If you’re tired of staring at “Collecting dependencies…” for minutes, uv is your new best friend.
- It replaces multiple tools. If you’re using pyenv, Poetry, and pipx separately, you can cut down your toolchain complexity.
- Python version management built-in. No need to rely on pyenv to manage different versions of Python—uv does it natively.
- Reproducible environments. Thanks to lockfiles (uv.lock), you get fully deterministic installs, similar to Poetry.
- It just works. No messing with shell scripts, PATH issues, or activation quirks. It’s smooth.
Installing uv
The folks at Astral (the creators) made uv
super easy to install. Here’s how you do it:
📦 Install uv (the recommended way)
On macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
On Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Alternatively, via pip or pipx (my favorite way)
pip install uv
Once installed, you can check if it’s working:
uv --version
Setting Up a New Python Project with uv
Alright, let’s say you’re starting a new Python project. Normally, you’d go through the whole:
python -m venv .venv
source .venv/bin/activate
pip install ...
pip freeze & requirements.txt
With uv, it’s way simpler:
uv init my_project
cd my_project
This automatically creates a virtual environment inside the project and sets up a pyproject.toml file (like Poetry).
Adding dependencies? Just run:
uv add requests
This:
✅ Installs requests in a snap
✅ Updates your pyproject.toml
✅ Updates uv.lock (so you get reproducible installs)
Want to remove it?
uv remove requests
Running Python Code with uv
uv has an easy way to run scripts inside its environment without manually activating anything.
uv run python script.py
This ensures your script runs inside your project’s virtual environment, even if you’re not inside an activated shell session.
uv vs. Other Python Environment Tools
Let’s compare uv against some of the big players:
Feature | uv | venv | pip | Poetry | pyenv |
---|---|---|---|---|---|
Installs Packages | ✅ | ❌ | ✅ | ✅ | ❌ |
Lockfile Support | ✅ | ❌ | ❌ | ✅ | ❌ |
Python Version Management | ✅ | ❌ | ❌ | ❌ | ✅ |
Runs CLI Tools (pipx alternative) | ✅ | ❌ | ❌ | ❌ | ❌ |
Reproducible Installs | ✅ | ❌ | ❌ | ✅ | ❌ |
Speed | 🚀🚀🚀 | 🚶 | 🐢 | 🐇 | 🚶 |
If you’re currently using venv + pip, uv is a massive upgrade. If you’re using Poetry, it’s more of a lateral move, but the speed boost alone might make you switch.
Using uv in Docker
I always try to set up my projects so they work well in both local and containerized environments. uv makes that easier too.
Here’s how I set up a Dockerfile with uv:
FROM python:3.13-alpine
# Install uv
RUN pip install uv
# Set up the application
WORKDIR /app
COPY . /app
# Create the virtual environment
RUN uv venv .venv
# Ensure the environment is activated for `uv sync`
ENV VIRTUAL_ENV=/app/.venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Install dependencies
RUN uv sync
# Run the application
CMD ["uv", "run", "python", "script.py"]
Final Thoughts: Should You Use uv?
After testing uv, I’m pretty convinced that this is the future of Python package management. The speed, simplicity, and feature set make it a no-brainer for anyone tired of sluggish pip installs or juggling multiple tools.
If you’re still using venv + pip, I highly recommend giving uv a shot. If you’re using Poetry, it’s at least worth testing—especially if you’re frustrated with Poetry’s occasional slowness.
At the very least, it’s another great tool to have in your Python toolbox. And who knows? You might just end up replacing your entire workflow with it.