Repository navigation
Use implementation_name to resolve wheel-only releases - #23335
charliermarsh wants to merge 1 commit into
Conversation
| } | ||
|
|
||
| marker = marker.or(tree); | ||
| marker = marker.or(version.and(wheel_implementation_marker(*python_tag))); |
There was a problem hiding this comment.
[P2] Exclude implementation-incompatible wheels before checking index hashes
The new fork can select 1.0 only outside CPython. If 1.0 has a py3-none-any wheel with SHA-256 and a cp311 wheel with only SHA-512, is_wheel_unreachable_for_marker retains both, so uv lock fails on an index requiring SHA-256 even though the CPython wheel cannot be installed in that fork. The lock filter already missed explicit implementation restrictions at the merge base, but the two-release example previously selected only 2.0 and never checked 1.0’s wheels. Apply the union of the wheel’s implementation markers in the lock filter before hash selection, keeping unknown tags conservative. If split out, land that fix first.
ad2f0a8 to
ad0314f
Compare
ad0314f to
c9e839f
Compare
c9e839f to
97d09ba
Compare
97d09ba to
14e3782
Compare
| "example-1.0-graalpy313-none-any.whl", | ||
| "python_full_version == '3.13.*' and implementation_name == 'graalpy'", |
There was a problem hiding this comment.
[P3] Use an installable GraalPy tag in the marker test
Tags::from_env emits an implementation-specific *-none-any tag only for CPython, so uv cannot select graalpy313-none-any on GraalPy. Use a tag already present in the ecosystem fixtures, such as graalpy312-graalpy250_312_native-macosx_10_13_x86_64, and expect 3.12.*. That tests the same implementation_name == 'graalpy' inference without asserting coverage for an unusable wheel.
| } | ||
|
|
||
| marker = marker.or(tree); | ||
| marker = marker.or(version.and(wheel_implementation_marker(*python_tag))); |
There was a problem hiding this comment.
[P2] Preserve locked build hashes when an implementation fork narrows wheel coverage
Consider a runtime dependency used on Windows or on non-CPython Linux, with non-CPython listed in required-environments. If 2.0 has only CPython wheels for both platforms and 1.0 has a generic wheel, re-resolving an existing lock now selects 2.0 only on Windows. If the index supplied a hash only for the Linux wheel, the lock writer drops 2.0’s last recorded digest without a package upgrade. Lock::hash_strategy then skips 2.0, so a CPython Linux isolated build requiring 2.0 without a separate build hash can install a publisher’s replacement wheel during uv sync --frozen. The previous lock enforced the original digest. Retain that digest for builds or require an explicit upgrade before discarding it.
Summary
Consider a package with two releases. Version 1.0 has a generic Python wheel, and 2.0 has only a CPython wheel. Neither release has a source distribution. A project can ask uv to ensure that a release is available for an interpreter other than CPython.
uv can choose 2.0 everywhere. It infers
platform_python_implementation == 'CPython'from thecp311tag. That condition can hold on Pyston, whoseimplementation_nameispyston, so the resolver counts the CPython wheel toward the requirement.We now infer
implementation_name == 'cpython'fromcp311, just as we infersys_platform == 'linux'from a Linux wheel. The resolver selects 2.0 on CPython and 1.0 elsewhere. The relationship from #23334 lets the same inferred marker answer questions aboutplatform_python_implementation. This also applies whenenvironmentsrestricts the supported interpreters and when choosing between a local version and its base version.New resolutions can use
implementation_namein the generated fork markers. An existing lock can keep its previous fork markers until uv resolves again.This should land together with #23310. A fork can select a release only on PyPy, for example. The writer needs to skip its CPython wheels before checking that the index provided the required hash for each file.