For years, setting up Python meant juggling pip, virtualenv, pyenv and a requirements.txt that never quite matched production. uv, from Astral, the team behind the Ruff linter, combines those jobs in one very fast tool written in Rust. It has quickly become a popular default for new Python projects.
Install uv
# macOS and Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# or with Homebrew
brew install uvInstall and pin a Python version
uv python install 3.13 # downloads a managed Python build
uv python list # shows installed and available versionsStart a project
uv init sales-report
cd sales-report
uv add pandas openpyxl duckdb # adds to pyproject.toml and updates uv.lock
uv add --dev ruff pytest # development-only dependenciesThis creates a pyproject.toml describing your dependencies and a uv.lock file recording exact versions. Commit both to Git so everyone, including your server, runs the same versions.
Run code without activating anything
uv run python report.py # creates or updates .venv automatically, then runs
uv run pytest
uv sync # install exactly what uv.lock specifiesSingle-file scripts with inline dependencies
For a quick automation, you can declare dependencies at the top of the script itself, following the inline script metadata standard (PEP 723).
# /// script
# requires-python = ">=3.12"
# dependencies = ["pandas", "openpyxl"]
# ///
import pandas as pd
df = pd.read_excel("sales.xlsx")
print(df.groupby("region")["amount"].sum())uv run report.py # uv installs pandas and openpyxl in an isolated environment firstRun tools without installing them
uvx ruff check . # lint your code
uvx ruff format . # format itComing from requirements.txt
uv add -r requirements.txt # import an existing list into a project
uv export --format requirements-txt > requirements.txt # produce one for other toolsuv also offers a pip-compatible interface, such as uv pip install pandas, so it drops into existing workflows easily.
Written by Alessandro Ecclesie Agazzi, freelance analytics engineer in London. Updated 30 September 2026.