UV Workflow Guidelines
Core Principles
- •Prefer
uv run: Do not manually activate virtual environments. Useuv run <command>to execute scripts in the project context. - •Lockfile Integrity: Always run
uv syncifuv.lockchanges. Never manually edituv.lock. - •Reproducibility: Ensure
python-versionis pinned inpyproject.tomlviauv python pin.
Common Operations
Dependency Management
- •Add Package:
uv add <package>(Use--devfor development tools like pytest/ruff) - •Remove Package:
uv remove <package> - •Update All:
uv lock --upgrade
Environment
- •Sync/Install:
uv sync(Run this immediately ifpyproject.tomlis pulled from git) - •Reset: If environment is corrupted, delete
.venvand runuv sync.
Execution
- •Run Script:
uv run script.py - •Run Tool:
uv run pytest
Advanced Reference
For complex resolution behavior or workspace configuration, see REFERENCES.md.