| name | uv |
| description | Use `uv` as the default Python tool for package management, environments, and self-contained scripts instead of separate `pip`, `venv`, `poetry`, or raw `python` workflows. Trigger on mentions of uv, Python dependency management, `uv run`, inline script metadata, PEP 723, virtualenv setup, or `uv_build` backend setup. |
Use this skill when the user wants help with Astral uv. Keep the main flow short, then use the reference docs for deeper details.
Quick ref
Use uv run to run scripts, modules, or commands inside a Python environment.
uv run file.py
uv run -s ./script-without-py-extension
uv run -- python --version
uv run -- ruff check
uv run -- pytest -q
uv run -p 3.12 -- python
uv run --python 3.11 example.py
uv run --with rich example.py
uv run --with 'rich>12,<13' example.py
uv run --with ruff -- ruff check example.py
uv run --with pyright -- pyright example.py
Key rule: put all uv options before the command, and prefer -- when you want the split to be explicit.
Inline script dependencies
Use PEP 723 inline metadata when the user wants a single-file script with declared dependencies.
uv init --script example.py --python 3.12
uv add --script example.py requests rich
uv remove --script example.py rich
uv run example.py
uv lock --script example.py
uv tree --script example.py
uv export --script example.py
uv sync --script example.py
uv audit --script example.py
uv run -- python -m ast example.py >/dev/null
uv lock --script example.py
uv audit --script example.py
Use uv run --with for temporary deps; use uv add --script when the dependencies should live in the script.
For full details, read references/inline-script-dependencies.md.
Build backend
Be opinionated here: for a new package, prefer uv init --package --build-backend uv.
uv init --package --build-backend uv
uv build
[build-system]
requires = ["uv_build>=0.11.2,<0.12"]
build-backend = "uv_build"
Important note: uv_build currently supports pure Python projects only.
For full details, read references/build-backend.md.