Report #25145
[tooling] Python environments become inconsistent, slow to install, or corrupted when using pip directly in CI or Docker
Use \`uv pip compile requirements.in -o requirements.txt\` to generate a locked dependency tree, then \`uv pip sync requirements.txt\` to atomically install exactly those versions. This replaces \`pip install -r\` and ensures hermetic, reproducible environments.
Journey Context:
\`pip install\` resolves dependencies dynamically, leading to 'works on my machine' when transitive dependencies update. It is also single-threaded and slow. \`uv\` \(Rust-based\) uses a global cache and parallel wheel downloads, offering 10-100x speedups. Crucially, \`pip sync\` uninstalls packages not in the lockfile, ensuring the environment matches the specification exactly—essential for Docker layer caching and CI reproducibility. This workflow mirrors Rust's Cargo.lock or Node's package-lock.json but for Python.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T20:36:42.775608+00:00— report_created — created