uv - The Fast Toolchain
uv is an all-in-one Python package manager written in Rust. It replaces pip, venv, pip-tools, and pyenv with a single fast CLI - the recommended default for Python 3.14 projects.
Search across all documentation pages
uv is an all-in-one Python package manager written in Rust. It replaces pip, venv, pip-tools, and pyenv with a single fast CLI - the recommended default for Python 3.14 projects.
Quick-reference recipe card - copy-paste ready.
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# New project
uv init myapp && cd myapp
uv add fastapi pydantic
uv run uvicorn myapp.main:app --reload
# Existing project
uv sync
uv run pytestWhen to reach for this:
pip install + manual venv workflows#!/usr/bin/env bash
set -euo pipefail
# Bootstrap a FastAPI service with uv
uv init invoice-api
cd invoice-api
uv add "fastapi>=0.115" "uvicorn[standard]>=0.34" "pydantic>=2"
cat > src/invoice_api/main.py <<'PY'
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Invoice(BaseModel):
id: int
amount: float
@app.get("/health")
def health() -> dict[str, str]:
return {"status": "ok"}
@app.post("/invoices")
def create(invoice: Invoice) -> Invoice:
return invoice
PY
uv run uvicorn invoice_api.main:app --host 0.0.0.0 --port 8000What this demonstrates:
uv init scaffolds pyproject.toml, src/ layout, and .venvuv add resolves dependencies and updates uv.lockuv run executes inside the project environment without manual activationsrc/ package automatically.venv directoriesuv.lock is a universal lockfile (PEP 751 compatible) with exact versions and hashesuv python manages interpreter downloads alongside package management| Command | Purpose |
|---|---|
uv init | Create new project with pyproject.toml |
uv add <pkg> | Add runtime dependency |
uv remove <pkg> | Remove dependency |
uv sync | Install from lockfile |
uv lock | Regenerate lockfile |
uv run <cmd> | Run command in project venv |
uv pip install | pip-compatible install interface |
uv python install | Download Python interpreters |
# Pin interpreter for the project
uv python pin 3.14
# Run against a specific version without changing the pin
uv run --python 3.13 pytest
# Upgrade all dependencies
uv lock --upgradeuv sync after clone - imports fail with ModuleNotFoundError. Fix: run uv sync (or uv sync --frozen in CI) before any command.uv pip if you need pip semantics.uv.lock - teammates get different dependency versions. Fix: commit the lockfile; use uv sync --frozen in CI.uv add without updating lock - pyproject.toml and lockfile drift. Fix: uv add updates both; if editing pyproject.toml by hand, run uv lock after.uv pip install - pollutes the system interpreter. Fix: always work inside a project (uv init / uv sync) or pass --python explicitly.| Alternative | Use When | Don't Use When |
|---|---|---|
| pip + venv | Legacy projects, minimal tooling | You need lockfiles or speed |
| Poetry | Team already standardized on Poetry | Starting fresh (uv is faster) |
| PDM | PEP 582 __pypackages__ workflow preferred | You want a traditional .venv |
| conda/mamba | Scientific stack with C libs | Pure PyPI web apps |
uv provides uv pip for pip-compatible commands and uv add/uv sync for project workflows. You can migrate incrementally.
A global cache (typically ~/.cache/uv/). Project .venv directories hardlink from the cache, saving disk space.
Yes: uv pip install -r requirements.txt. For long-term maintenance, migrate to pyproject.toml with uv add.
uv lock --upgrade-package httpx then uv sync.
Yes. Install via powershell -c "irm https://astral.sh/uv/install.ps1 | iex".
uv sync installs dependencies into .venv. uv run executes a command inside that environment.
Yes. Use [dependency-groups] in pyproject.toml and uv sync --group dev.
uv focuses on install speed and lockfile management. For building and publishing wheels, pair uv with hatchling or use uv build / uv publish.
No. uv run handles environment activation. Manual source .venv/bin/activate still works if you prefer.
export UV_INDEX_URL=https://pypi.internal/simple/ or configure [[tool.uv.index]] in pyproject.toml.
Stack versions: This page was written for Python 3.14.0, FastAPI 0.115+, Django 5.2, Flask 3.1, Pydantic 2, PyTorch 2.6+, pandas 2.2+, Polars 1.x, ruff 0.9+, and uv 0.6+.
Reviewed by Chris St. John·Last updated Jul 19, 2026