uv — Policy
Precedence: this policy (below) > astral:uv (if installed) / live docs.astral.sh for command
syntax, migration tables, and general usage (not duplicated here).
Policy
- Follow
python-engineering:standards-for-python-developmentfor shared architecture, typing, testing, and CLI rules. - Use
uv add/uv sync/uv runfor all Python work — neveruv pip install,uv venv, orsource .venv/bin/activate. Auv.lock-managed project with PEP 723 scripts never needs the pip-compatible lane Astral documents. - PEP 723 script shebang:
#!/usr/bin/env -S uv run --quiet --script. Never add--active— it breaks PEP 723 isolation by resolving into an ambientVIRTUAL_ENVinstead of an isolated ephemeral one. - Use text mode (
'r'/'w') withtomlkit, never binary mode ('rb'/'wb') — binary mode returnsbytes, whichtomlkitcannot parse or write.