UV Astral

Posted on Oct 22, 2025

Install

curl -LsSf https://astral.sh/uv/install.sh | sh

Documentation: https://docs.astral.sh/uv/

Virtual environments

PurposeCommand
Create venv with Python versionuv venv .venv --python 3.12.0

Dependency management

PurposeCommand
Generate lock fileuv lock
Sync dependenciesuv sync
Sync with extrasuv sync --extra dev
List installed packagesuv pip list
List outdated packagesuv pip list --outdated
Upgrade installed packagesuv pip install --upgrade <name>

Python versions

PurposeCommand
Install Python versionsuv python install 3.12 3.13 3.14
Pin Python versionuv python pin 3.12
List installed Pythonsuv python list --only-installed
Find system Python (ignore venv)uv python find --system

Ruff

PurposeCommand
Lint codeuv run ruff check .
Format codeuv run ruff format

Pytest

PurposeCommand
Run testsuv run pytest
Quiet modeuv run pytest -q
Show stdout / printsuv run pytest -s
show detailed test outputùv run pytest -v`