uv: The Fastest Python Package Manager for Python
April 16, 2025
Table of Contents
uv: The Fastest Python Package Manager for Python
What is uv?
uv is a blazing fast, all-in-one Python package and project manager built in Rust by the creators of Ruff.
It aims to replace tools like:
- pip, pip-tools, pipx, virtualenv
- poetry, pyenv, and twine
Highlights
- 10–100x faster than pip
- One tool for everything: deps, envs, Python versions, tools
- Manages Python versions
- Uses global cache for space-efficient installs
- Compatible with pip CLI
How to Install uv
With curl (recommended)
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
With pip or pipx
pip install uv
# or
pipx install uv
To update:
uv self update
How to Use uv
1. Creating a new project
uv init myproject
cd myproject
uv add requests
uv run script.py
- Initializes a pyproject.toml
- Creates .venv
- Adds dependencies and runs your code
2. Using uv in an existing project
cd existing-project
uv venv # create/manage virtualenv
uv sync # install from lockfile
uv run app.py # run code inside env
# Optional: uv compile # compile deps into lockfile
- Works even if you're not using uv for setup
- Compatible with requirements.txt and pyproject.toml
uv Cheat Sheet
Based on SaaS Pegasus Deep Dive
# Project setup
uv init myproject # Init new project
uv venv # Create/manage virtualenv
uv python install 3.11 # Install specific Python version
uv python pin 3.11 # Use specific Python version
# Dependency management
uv add requests # Add dependency
uv remove requests # Remove dependency
uv compile # Create uv.lock
uv sync # Install from lockfile
uv pip install -r req.txt # Use pip commands
uv pip sync file.txt # Install from requirements.txt
# Run scripts
uv run script.py # Run Python file
uv run "command" # Run shell command in venv
# Tools
uv tool install ruff # Install CLI tool like pipx
uvx pycowsay "hello world" # Run tool temporarily
# Scripts with inline metadata
uv add --script script.py requests # Inject deps into script
uv run script.py # Run it in isolated env
# Cache and maintenance
uv cache clean # Clear cache
uv self update # Update uv itself
Pros and Cons
Pros
- Extremely fast (Rust-powered)
- Drop-in pip & pipx replacement
- All-in-one (env, deps, tools, Python)
- Global cache saves space
- Universal lockfile
- Great for mono-repos (Cargo-style workspaces)
Cons
- Still new—less mature than pip/poetry
- Not all advanced features from poetry yet
- Smaller ecosystem
Conclusion
uv is not just fast—it's a serious contender to unify the Python tooling ecosystem. Whether you're a beginner or managing large workspaces, it's worth trying today.