Repository navigation
uv.lock: refuse targets outside the lock's [tool.uv] environments instead of reporting false gaps - #654
Merged
Conversation
A uv.lock made with environments (supported-markers) leaves out the packages and wheels other platforms need, and uv sync fails there. wheelgap read it as complete and reported those platforms as source/missing: false gaps in 8 of 82 root uv.lock files of the 300 most-starred Python repos. A requested target outside the environments is now an error (as for a pip report made for another environment), and the built-in default platforms are narrowed to the ones the lock covers. Co-Authored-By: Claude Fable 5.2 <[email protected]>
The entry for the PR, now that it has a number. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…e Python API; drop uncovered advisory targets Review found that wheelgap diff, the Action's compare step, MCP diff_lockfiles and check_lockfile() with no targets failed outright on an environments-limited lock, and that an --advisory target outside the environments failed the run. Targets the user named stay an error. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…latform; say what diff drops Review found that wheelgap diff and MCP diff_lockfiles with a requirements file on one side dropped the platforms the uv.lock gave up instead of refusing them, and that the docs said diff keeps the platforms both locks cover when it drops only those both leave out. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # CHANGELOG.md # src/wheelgap/cli.py
# Conflicts: # CHANGELOG.md
…on below the lock's requires-python With no targets the default Python is the running one; on 3.11 that is below the fixture's >=3.12, which wheelgap rechecks on PyPI as it always has. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 21, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A
uv.lockmade with[tool.uv] environments(the lock'ssupported-markers) is now checked only where uv installs it.-t,[tool.wheelgap] targets,--dockerfile, a-p) and is outside the lock's environments is an error: exit code 2, the usualwheelgap: error:line, and the error object with--json. It names the targets the lock doesn't cover, the markers, and the asked-for targets it does cover.-q;--json'stargetsshows what was checked). A default platform covered for only some of the requested Pythons stays and is the error above.platform_release,platform_machineonwin32, a patch-levelpython_full_version, a marker that doesn't parse), wheelgap says it can't tell and stops (exit 2) rather than guess.check_lockfile),wheelgap diffand the MCP tools go through the same check.Why
uv locks such a project for its environments only. It leaves out the packages that only other environments need and the wheels for other platforms, and
uv syncfails anywhere else. wheelgap read the lock as complete, so the left-out platforms showed assource/missingwith no note: a wrong answer.On the 300 most-starred Python repos, 8 of 82 root
uv.lockfiles havesupported-markers. With-p 3.13 -t linux-x86_64,linux-aarch64,macos-arm64,win-amd64 --offline, 6 of the 8 had cells outside their environments:-tpython_version >= '3.14')How it follows uv
supported-markersis[tool.uv] environments(crates/uv-lock/src/lock/mod.rs,LockWire);required-markersisrequired-environmentsand doesn't limit where the lock installs.uv syncrefuses a platform where none of the supported markers holds (uv-environment-operations/src/sync.rs), andLock::from_resolutiondrops the wheels that can't be reached inside the environments.environments = ["sys_platform == 'linux' and platform_machine == 'x86_64'"]andcolorama; sys_platform == 'win32'.uv lockwrote a lock without colorama and without markupsafe's Windows and macOS wheels;uv sync --dry-runon macOS failed with "The current Python platform is not compatible with the lockfile's supported environments";uv sync --dry-run --python-platform x86_64-unknown-linux-gnuworked. That lock is the new fixturetests/fixtures/uvenvironments. A marker that is always true insiderequires-pythonis written as an emptysupported-markerslist, which means no limit here too.check.marker_value), sopython_full_versionis probed across the minor's patch releases.The model is the one a pip installation report already has (
check_report_targets): an input resolved for some environments is refused on others. Therequires-pythoncase (note, then a re-check on the index) doesn't fit here, because an index lookup can add wheels but not the packages the lock left out.Issue #71 (default targets from
required-environments) works as before; its tests pass unchanged.Open question
For targets that were asked for, this PR stops the whole run (exit 2) rather than dropping the uncovered targets and checking the rest. That never gives a wrong answer, and the message lists the covered targets to rerun with, but
-t allon a Linux-only lock is now an error instead of a partial table. Dropping them with a note and a--jsonkey would be friendlier; it would also pass a CI run that asked for a platform nobody checked.wheelgap diffand the Python API don't narrow default platforms (only the command line and the MCPcheck_lockfiletool, which runs it, do).Verified
ruff check,ruff format --check,mypypass locally.Made with Claude Code.
🤖 Generated with Claude Code