DEMO: Changing Python constraints changes deriviation tree ordering

This commit is contained in:
Zanie 2024-01-19 16:27:47 -06:00
parent 459c2abc81
commit 6e38f50eea
2 changed files with 3 additions and 19 deletions

View File

@ -652,22 +652,6 @@ impl<'a, Provider: ResolverProvider> Resolver<'a, Provider> {
self.visit_package(package, priorities, request_sink)?;
}
// If a package has a `requires_python` field, add a constraint on the target
// Python version.
if let Some(requires_python) = metadata.requires_python.as_ref() {
let version = requires_python
.iter()
.map(PubGrubSpecifier::try_from)
.fold_ok(Range::full(), |range, specifier| {
range.intersection(&specifier.into())
})?;
constraints.insert(
PubGrubPackage::Python(PubGrubPython::Installed),
version.clone(),
);
constraints.insert(PubGrubPackage::Python(PubGrubPython::Target), version);
}
// If a package has an extra, insert a constraint on the base package.
if extra.is_some() {
constraints.insert(

View File

@ -690,14 +690,14 @@ fn dependency_excludes_non_contiguous_range_of_compatible_versions() -> Result<(
crow>2.0.0
and crow==1.0.0 depends on albatross<2.0.0, we can conclude that crow<2.0.0 depends on albatross<2.0.0. (1)
Because albatross==1.0.0 depends on bluebird==1.0.0 and there are no versions of albatross that satisfy any of:
Because there are no versions of albatross that satisfy any of:
albatross<1.0.0
albatross>1.0.0,<2.0.0
we can conclude that albatross<2.0.0 depends on bluebird==1.0.0.
and albatross==1.0.0 depends on bluebird==1.0.0, we can conclude that albatross<2.0.0 depends on bluebird==1.0.0.
And because we know from (1) that crow<2.0.0 depends on albatross<2.0.0, we can conclude that crow<2.0.0 depends on bluebird==1.0.0.
And because crow==2.0.0 depends on albatross>=3.0.0 we can conclude that all versions of crow, bluebird!=1.0.0, albatross<3.0.0 are incompatible. (2)
Because albatross==3.0.0 depends on bluebird==3.0.0 and only albatross<=3.0.0 is available, we can conclude that albatross>=3.0.0 depends on bluebird==3.0.0.
Because only albatross<=3.0.0 is available and albatross==3.0.0 depends on bluebird==3.0.0, we can conclude that albatross>=3.0.0 depends on bluebird==3.0.0.
And because we know from (2) that all versions of crow, bluebird!=1.0.0, albatross<3.0.0 are incompatible, we can conclude that all versions of crow depend on one of:
bluebird<=1.0.0
bluebird>=3.0.0