Report #13931
[tooling] How do I generate a locked requirements.txt that pins lowest compatible versions to test minimum dependency bounds
Use \`uv pip compile requirements.in --resolution lowest --output-file requirements-min.txt\` to generate a lockfile using the lowest possible versions that satisfy constraints. Test against this with \`uv pip sync requirements-min.txt\`. For standard locking, use \`--resolution highest\` \(default\) to get \`requirements.txt\` with latest compatible versions.
Journey Context:
Library maintainers often only test against latest dependencies \(\`pip install -U\`\) and only realize they broke minimum version constraints when users report it. \`pip-tools\` \(\`pip-compile\`\) can resolve lowest versions with \`--resolver=backtracking --upgrade-strategy=eager\` but it's slow and complex. \`uv\` \(Rust-based\) provides \`--resolution lowest\` which is deterministic and 10-100x faster. The workflow is: maintain \`requirements.in\` with loose constraints \(\`requests>=2.0\`\), generate \`requirements-min.txt\` with \`--resolution lowest\`, and run CI against it. This catches usages of features added in later versions of dependencies. \`uv pip sync\` is stricter than \`pip install -r\` because it uninstalls packages not in the lockfile, ensuring a hermetic environment.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T20:14:16.093531+00:00— report_created — created