Re-enable requires-python narrowing in forks (#5583)

See: https://github.com/astral-sh/uv/issues/4669
See: https://github.com/astral-sh/uv/issues/4668
See: https://github.com/astral-sh/uv/pull/4902
This commit is contained in:
Charlie Marsh 2024-07-30 10:06:59 -04:00 committed by GitHub
parent 3e2ae93d6c
commit dfa780d6f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 98 additions and 53 deletions

View file

@ -50,19 +50,7 @@ impl PythonRequirement {
/// Narrow the [`PythonRequirement`] to the given version, if it's stricter (i.e., greater)
/// than the current `Requires-Python` minimum.
pub fn narrow(&self, _target: &RequiresPythonBound) -> Option<Self> {
// This represents a "small revert" of the PR that added
// Requires-Python version narrowing[1]. But narrowing has
// led to at least one bug[2] whose fix is not clear. We
// decided to revert narrowing under the idea that it is better
// to be strict (i.e., fail to resolve in some cases, like
// universal_requires_python in uv/tests/pip_compile) than it
// is to output an incorrect lock, as in [2].
//
// [1]: https://github.com/astral-sh/uv/pull/4707
// [2]: https://github.com/astral-sh/uv/issues/4885
None
/*
pub fn narrow(&self, target: &RequiresPythonBound) -> Option<Self> {
let Some(PythonTarget::RequiresPython(requires_python)) = self.target.as_ref() else {
return None;
};
@ -71,7 +59,6 @@ impl PythonRequirement {
installed: self.installed.clone(),
target: Some(PythonTarget::RequiresPython(requires_python)),
})
*/
}
/// Return the installed version of Python.