Skip to content

Commit

Permalink
Use correct ordering semantics for narrowing upper-bounded Python req…
Browse files Browse the repository at this point in the history
…uirements (#7031)

## Summary

We need to use different ordering semantics for upper and lower Python
bounds.

Closes #6911.
  • Loading branch information
charliermarsh authored Sep 4, 2024
1 parent 724a93b commit 1ccc15e
Show file tree
Hide file tree
Showing 15 changed files with 627 additions and 115 deletions.
4 changes: 1 addition & 3 deletions crates/uv-resolver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ pub use preferences::{Preference, PreferenceError, Preferences};
pub use prerelease::PrereleaseMode;
pub use pubgrub::{PubGrubSpecifier, PubGrubSpecifierError};
pub use python_requirement::PythonRequirement;
pub use requires_python::{
RequiresPython, RequiresPythonBound, RequiresPythonError, RequiresPythonRange,
};
pub use requires_python::{RequiresPython, RequiresPythonError, RequiresPythonRange};
pub use resolution::{AnnotationStyle, DisplayResolutionGraph, ResolutionGraph};
pub use resolution_mode::ResolutionMode;
pub use resolver::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Ok(
],
),
range: RequiresPythonRange(
RequiresPythonBound(
LowerBound(
Included(
"3.12",
),
),
RequiresPythonBound(
UpperBound(
Unbounded,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Ok(
],
),
range: RequiresPythonRange(
RequiresPythonBound(
LowerBound(
Included(
"3.12",
),
),
RequiresPythonBound(
UpperBound(
Unbounded,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Ok(
],
),
range: RequiresPythonRange(
RequiresPythonBound(
LowerBound(
Included(
"3.12",
),
),
RequiresPythonBound(
UpperBound(
Unbounded,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Ok(
],
),
range: RequiresPythonRange(
RequiresPythonBound(
LowerBound(
Included(
"3.12",
),
),
RequiresPythonBound(
UpperBound(
Unbounded,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Ok(
],
),
range: RequiresPythonRange(
RequiresPythonBound(
LowerBound(
Included(
"3.12",
),
),
RequiresPythonBound(
UpperBound(
Unbounded,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Ok(
],
),
range: RequiresPythonRange(
RequiresPythonBound(
LowerBound(
Included(
"3.12",
),
),
RequiresPythonBound(
UpperBound(
Unbounded,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Ok(
],
),
range: RequiresPythonRange(
RequiresPythonBound(
LowerBound(
Included(
"3.12",
),
),
RequiresPythonBound(
UpperBound(
Unbounded,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Ok(
],
),
range: RequiresPythonRange(
RequiresPythonBound(
LowerBound(
Included(
"3.12",
),
),
RequiresPythonBound(
UpperBound(
Unbounded,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Ok(
],
),
range: RequiresPythonRange(
RequiresPythonBound(
LowerBound(
Included(
"3.12",
),
),
RequiresPythonBound(
UpperBound(
Unbounded,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Ok(
],
),
range: RequiresPythonRange(
RequiresPythonBound(
LowerBound(
Included(
"3.12",
),
),
RequiresPythonBound(
UpperBound(
Unbounded,
),
),
Expand Down
7 changes: 3 additions & 4 deletions crates/uv-resolver/src/marker.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::requires_python::RequiresPythonRange;
use crate::RequiresPythonBound;
use crate::requires_python::{LowerBound, RequiresPythonRange, UpperBound};
use pep440_rs::Version;
use pep508_rs::{MarkerTree, MarkerTreeKind, MarkerValueVersion};
use pubgrub::Range;
Expand Down Expand Up @@ -62,7 +61,7 @@ pub(crate) fn requires_python(tree: &MarkerTree) -> Option<RequiresPythonRange>
let (lower, upper) = range.bounding_range()?;

Some(RequiresPythonRange::new(
RequiresPythonBound::new(lower.cloned()),
RequiresPythonBound::new(upper.cloned()),
LowerBound::new(lower.cloned()),
UpperBound::new(upper.cloned()),
))
}
Loading

0 comments on commit 1ccc15e

Please sign in to comment.