Skip to content

Match uv Requires-Python lower bounds when checking locks online - #623

Merged
patrickballard merged 6 commits into
wheelgap:mainfrom
kunalkshah1:fix/uv-requires-python-ranges
Nov 21, 2026
Merged

patrickballard merged 6 commits into
wheelgap:mainfrom
kunalkshah1:fix/uv-requires-python-ranges

Conversation

@kunalkshah1

Copy link
Copy Markdown
Contributor

Closes #605

What this changes

Use the lower edge of the combined release range for uv lock checks, while keeping rejected files visible in pip_refuses. Requirements files and other lock formats still follow pip.

The uv 0.13.9 wheel resolver calls is_contained_by, using release-only range conversions. On CPython 3.15.2, uv 0.13.8 installed synthetic local wheels with ==3.14., ~=3.14.0, >=3.10,!=3.15. and >=3.10,<3.15 using uv sync --locked --offline. It refused >=3.16 and >=3.15,!=3.15.*.

AI tools used: Codex

Ruff formatting and lint, mypy, and full pytest passed (5,199 passed, 3 skipped). The Unreleased entry will be added with the PR number.

Kunal Shah and others added 2 commits November 21, 2026 15:58
…ainst uv

how-it-works.md and output.md still said only < and <= bounds are read this way. The CHANGELOG bullet now says what a user sees. The table gains cases run against uv 0.13.9 itself: ==3.14.* and ~=3.14.0 stay left out on 3.13, ==3.14 and ===3.14 count on 3.15.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@patrickballard

Copy link
Copy Markdown
Collaborator

Thanks @kunalkshah1, this looks good overall: the uv.lock check now works out the lower edge of the whole Requires-Python range, as uv does, so ==3.14.*, ~= and != clauses are handled, while files pip refuses stay listed in pip_refuses. Linking the exact uv source lines and checking against a real uv sync makes this much easier to review.

CI is green on this commit.

#605 is a help wanted issue, so Patrick will review and merge this one himself. Nothing more needed from you for now.

(Review assisted by Claude.)

patrickballard and others added 2 commits November 21, 2026 10:53
CHANGELOG keeps both bullets, this PR's first.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
CHANGELOG keeps both bullets, this PR's first.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@patrickballard

Copy link
Copy Markdown
Collaborator

Thanks @kunalkshah1! #605 asked for uv's real rule first, so we checked it two ways: uv 0.13.9's source (is_contained_by compares only the lower bound of the range) and a real uv run on 21 Requires-Python shapes on 3.15 and 3.13. Your function matches every one, including ==3.14.* and ~=3.14.0 counting on 3.15 but not on 3.13, and != adding no lower bound.

We changed docs, changelog and tests only:

  • docs/how-it-works.md and docs/output.md still described the old rule; docs/inputs.md now says which clauses count.
  • The CHANGELOG bullet says what a user sees.
  • Eight more table cases, each checked against real uv.

It'll merge once a final review passes.

(Review assisted by Claude.)

@patrickballard
patrickballard merged commit 2c1bfeb into wheelgap:main Nov 21, 2026
13 checks passed
@patrickballard

Copy link
Copy Markdown
Collaborator

Merged, thanks @kunalkshah1! A second, independent check against uv 0.13.9 (its source, and a real run on 18 hand-built wheels on 3.13 and 3.15) agreed with your function on every case.

(Reply assisted by Claude.)

patrickballard added a commit to kunalkshah1/wheelgap that referenced this pull request Nov 21, 2026
patrickballard added a commit to kunalkshah1/wheelgap that referenced this pull request Nov 21, 2026
…t be pinned

main gained -c FILE and harmless pip flags (wheelgap#622), verified includes (wheelgap#621),
.dockerignore rules (wheelgap#626), install provenance (wheelgap#630), uv's Requires-Python
lower-bound rule (wheelgap#623) and MCP wording (wheelgap#624) since this branch was written.

_pip_install_files returns (files, constraints, prefer_binary, uv) and has one
flag loop with the uv branch first. On a uv line only uv's own flags are read:
--system, -r/--requirements, -c/--constraints, --no-cache, --no-cache-dir,
--upgrade/-U and --quiet/-q (checked against `uv pip install --help`, 0.13.1).
pip's --no-input, --root-user-action and --prefer-binary don't exist in uv, and
--disable-pip-version-check only warns there, so they are refused.

A uv line's files are found by the same copied_requirements closure as pip's,
so the ignore rules and the include checks apply. Three things are uv's own:
- every requirement must be pinned with == (through includes; a pin from a
  constraints file counts), using the gate --prefer-binary already had, and
  --deps is refused: wheelgap resolves a range as pip does, and uv can pick
  another release;
- a -r inside a constraints file is refused: pip installs what it names and uv
  only constrains with it (uv 0.13.1 against pip 26.2);
- included and -c files must be named *.txt or *.in, like the -r file.
A file installed by pip on one line and uv on another is refused, and a caller
that doesn't pass uv_installs gets an error rather than pip's answer.

cli.py: the stderr note keeps main's list of every file read and says which
installer ran; uv-installed files get restore_uv_python_files, as a uv.lock
with --online does, so the pip_refuses note is main's.

docs/cli.md has one paragraph for uv; CHANGELOG keeps every bullet once, this
PR's first, reworded.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@patrickballard patrickballard mentioned this pull request Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

uv.lock with --online: files left out by a ==3.14.*, ~= or != Requires-Python clause stay missing, though uv may install them

2 participants