uv: The Fast Python Package and Project Manager
uv is a Python package and project manager written in Rust. It replaces pip, pip-tools, virtualenv, pyenv and pipx with one tool, and it's dramatically faster.
Install
curl -LsSf https://astral.sh/uv/install.sh | sh
# or: pipx install uv, brew install uv
Start a project
uv init my-api && cd my-api
uv add fastapi "uvicorn[standard]" # adds to pyproject.toml and installs
uv add --dev pytest ruff
uv run fastapi dev main.py # runs inside the project's environment
uv creates .venv automatically and writes a uv.lock lockfile with exact versions for every platform. Commit both pyproject.toml and uv.lock.
Reproducible installs
uv sync # install exactly what the lockfile says
uv sync --frozen # in CI/Docker: fail if the lockfile is out of date
uv lock --upgrade-package fastapi
Manage Python versions
uv python install 3.13 3.14
uv python pin 3.14 # writes .python-version
Run tools without installing them
uvx ruff check .
uvx --from httpie http GET https://httpbin.org/get
uv tool install ruff # install permanently on your PATH
Single-file scripts with dependencies
# /// script
# dependencies = ["requests", "rich"]
# ///
import requests
from rich import print
print(requests.get("https://api.github.com/repos/astral-sh/uv").json()["stargazers_count"])
uv run fetch_stars.py # uv creates a temporary environment with those packages
Coming from pip
uv pip install -r requirements.txt works as a drop-in replacement, so you can adopt uv gradually before moving to pyproject.toml and uv.lock.
Was this article helpful?
Comments
No comments yet. Have a question or a tip? Be the first to share it.