Prioritize forks based on Python narrowing (#5642)

## Summary

First part of: https://github.com/astral-sh/uv/issues/4926. We should
solve forks that _don't_ expand the world of supported versions (e.g.,
`python_version >= '3.11'` enables us to select new packages, since we
narrow the supported version range).
This commit is contained in:
Charlie Marsh 2024-07-31 10:29:14 -04:00 committed by GitHub
parent 0dcec9eba8
commit f268b7c90a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 41 additions and 24 deletions

View file

@ -350,6 +350,12 @@ impl<'de> serde::Deserialize<'de> for RequiresPython {
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub struct RequiresPythonBound(Bound<Version>);
impl Default for RequiresPythonBound {
fn default() -> Self {
Self(Bound::Unbounded)
}
}
impl RequiresPythonBound {
pub fn new(bound: Bound<Version>) -> Self {
Self(match bound {