This guide is the complete, canonical workflow for managing Python project dependencies using uv. It provides a clear, two-mode approach, production-ready best practices, and drop-in templates to ensure reproducibility, security, and developer efficiency across teams.
uv operates in two distinct modes. Your team should choose one and use it consistently.
- Project Mode (Recommended): This is the modern, preferred approach. It's managed by commands like
uv add,uv lock, anduv sync, using the cross-platformuv.lockfile as the single source of truth for reproducibility. - Requirements Mode (Compatibility): This mode mirrors the classic
pip-toolsworkflow and is useful when you need arequirements.txtfile for legacy tools or specific deployment platforms.