If you’ve been working with Python for a while, chances are you’ve used pip more times than you can count.
Python packaging has historically been fragmented in pip, virtualenv, poetry, conda ... uv aims to unify much of that experience into one consistent tool.
What Can uv Do?
uv isn’t just a faster pip. It’s more like a unified Python packaging tool.
| Tool | What uv Does |
|---|---|
pip |
Install packages |
pip-tools |
Compile lock files |
pipx |
Install CLI tools |
virtualenv |
Create and manage environments |
poetry (partially) |
Project + dependency management |
Insallation
Visit Astral-uv before running these commands just in-case they have changed them.
- MacOS and Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
- Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Working with uv
Creating a FastAPI project
There are so many commands integrated with uv that I can’t cover in this article. So instead, let’s build a simple project with a virtual environment, specific python version, project metadata and dependencies all in few commands.
uv init my-app --python 3.12
cd my-app
uv add fastapi uvicorn
What uv did ?
uv init my-app --python 3.12
uv init initializes a brand-new Python project and configures it to use a specific Python version (3.12 in this case).
Behind the scenes, it:
📁 Creates the project directory (my-app) (with version-control .git) and generates a pyproject.toml (managing dependendicies)
Sets requires-python = ">=3.12" and depending resoution with locking support.
No manual setup. No boilerplate. No extra tooling.
uv add fastapi uvicorn
On adding the dependencies, it automatically:
- 📦 Creates a virtual environment (.venv/) if it doesn't already exist and installs the packages inside that environment
- Updates pyproject.toml - resolves dependencies and generates a uv.lock file for reproducible installs
Running the app - uv run
Updating main.py with
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
Run it with:
uv run uvicorn main:app --reload
uv run ensures the command executes inside the managed environment — no activation needed.
Learning uv
Nothing better than reading their documentation - Astral - UV docs
That’s the beauty of uv - it removes the initial setup and keeps the workflow focused on building, not managing tools, another great tool built with rust 🦀


Top comments (0)