Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scenarios/fork: add basic overlapping markers test case #206

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions scenarios/fork/overlapping-markers-basic.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name = "fork-overlapping-markers-basic"
description = '''
This scenario tests a very basic case of overlapping markers. Namely,
it emulates a common pattern in the ecosystem where marker expressions
are used to progressively increase the version constraints of a package
as the Python version increases.

In this case, there is actually a split occurring between
`python_version < '3.10'` and the other marker expressions, so this
isn't just a scenario with overlapping but non-disjoint markers.

In particular, this serves as a regression test. uv used to create a
lock file with a dependency on `a` with the following markers:

python_version < '3.10' or python_version >= '3.11'

But this implies that `a` won't be installed for Python 3.10, which is
clearly wrong.

The issue was that uv was intersecting *all* marker expressions. So
that `a>=1.1.0` and `a>=1.2.0` fork was getting `python_version >=
'3.10' and python_version >= '3.11'`, which, of course, simplifies
to `python_version >= '3.11'`. But this is wrong! It should be
`python_version >= '3.10' or python_version >= '3.11'`, which of course
simplifies to `python_version >= '3.10'`. And thus, the resulting forks
are not just disjoint but complete in this case.

Since there are no other constraints on `a`, this causes uv to select
`1.2.0` unconditionally. (The marker expressions get normalized out
entirely.)
'''

[resolver_options]
universal = true

[expected]
satisfiable = true

[root]
requires = [
"a>=1.0.0 ; python_version < '3.10'",
"a>=1.1.0 ; python_version >= '3.10'",
"a>=1.2.0 ; python_version >= '3.11'",
]

[packages.a.versions."1.0.0"]
[packages.a.versions."1.1.0"]
[packages.a.versions."1.2.0"]