⚡ Lightning Blog: uv
pip, but on rocket fuel.
What Is It?
uv is a Python package and project manager. Written in Rust. Blazingly fast.
Wait, what’s a package manager? A package manager downloads libraries your code depends on (Flask, pandas, requests) and tracks their versions. A project manager handles setup—creating isolated environments, managing dependencies, running scripts. uv does both.
Think of it as pip, pip-tools, virtualenv, and pyenv—combined into one tool that actually respects your time.
Why Does It Exist?
Python packaging has been... complicated.
pipinstalls packages but doesn’t lock versions reliablypip-toolsgenerates lock files but adds another stepvirtualenvcreates environments but you manage them separatelypyenvhandles Python versions but that’s yet another tool
uv unifies all of this. One tool. Installs packages. Manages environments. Handles Python versions. Creates lock files.
And it does everything faster than you thought possible.
Why Is It the Best?
Speed. Installing packages is 10-100x faster than pip. Not exaggerating. A fresh Django install that took 30 seconds? Now takes 2 seconds.
Reliability. Proper dependency resolution. Lock files that actually work. No more “works on my machine.”
Simplicity. Replace your entire Python toolchain with one binary. One command to rule them all.
Compatibility. Works with existing requirements.txt and pyproject.toml. Migrate gradually.
Self-contained. Single binary. No dependencies. Install it and go.
Quick Setup
Install
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Or with Homebrew
brew install uvBasic Usage
# Create a new project
uv init my-project
cd my-project
# Add dependencies
uv add requests flask pytest
# Add dev dependencies
uv add --dev ruff pytest-cov
# Run your code (auto-creates venv)
uv run python main.py
# Run a script
uv run pytest
# Sync dependencies from lock file
uv syncReplace pip Workflows
# Instead of: pip install -r requirements.txt
uv pip install -r requirements.txt
# Instead of: pip install package
uv pip install requests
# Instead of: pip freeze > requirements.txt
uv pip freeze > requirements.txtPython Version Management
# Install a Python version
uv python install 3.12
# Use specific version for project
uv python pin 3.12
# List available versions
uv python listProject Structure
After uv init, your project looks like:
my-project/
├── .venv/ # Virtual environment (auto-created)
├── pyproject.toml # Project config and dependencies
├── uv.lock # Lock file (commit this!)
└── main.pyThe pyproject.toml
[project]
name = "my-project"
version = "0.1.0"
requires-python = ">=3.11"
dependencies = [
"requests>=2.31.0",
"flask>=3.0.0",
]
[tool.uv]
dev-dependencies = [
"ruff>=0.4.0",
"pytest>=8.0.0",
]The Commands You’ll Use Daily
uv add <package> # Add a dependency
uv remove <package> # Remove a dependency
uv sync # Install all dependencies from lock
uv run <command> # Run something in the venv
uv lock # Update the lock filePro Tip
Add this to your shell profile:
alias uvr="uv run"Now uvr pytest runs tests. uvr python main.py runs your code. Life gets easier.
Learn More
uv: Because waiting for pip is so 2023.

