make universal resolver fork only when markers are disjoint (#4135)

The basic idea here is to make it so forking can only ever result in a
resolution that, for a particular marker environment, will only install
at most one version of a package. We can guarantee this by ensuring we
only fork on conflicting dependency specifications only when their
corresponding markers are completely disjoint. If they aren't, then
resolution _must_ find a single version of the package in the
intersection of the two dependency specifications.

A test for this case has been added to packse here:
https://github.com/astral-sh/packse/pull/182. Previously, that test
would result in a resolution with two different unconditional versions
of the same package. With this change, resolution fails (as it should).

A commit-by-commit review should be helpful here, since the first commit
is a refactor to make the second commit a bit more digestible.
This commit is contained in:
Andrew Gallant 2024-06-07 19:40:55 -04:00 committed by GitHub
parent 0db1bf4df7
commit c46fa74e65
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 484 additions and 204 deletions

View file

@ -1,2 +1,2 @@
chevron-blue
packse>=0.3.17
packse>=0.3.18

View file

@ -46,7 +46,7 @@ nh3==0.2.17
# via readme-renderer
packaging==24.0
# via hatchling
packse==0.3.17
packse==0.3.18
# via -r scripts/scenarios/requirements.in
pathspec==0.12.1
# via hatchling