Repository navigation
Revert "Parse wheel variant dependency markers" - #23373
Conversation
| let extra_marker = if requirement.marker.is_false() { | ||
| MarkerTree::TRUE | ||
| } else { | ||
| requirement.marker.only_extras() | ||
| }; |
There was a problem hiding this comment.
[P2] An inactive dependency can trigger a constrained source build
For an ordinary marker such as python_version < '0', this branch emits the matching constraint even though the dependency is unreachable. If the constraint points to a source distribution with dynamic metadata, uv pip compile can queue that URL during lookahead and run the publisher’s build backend despite there being no active requirement for the package.
| let extra_marker = if requirement.marker.is_false() { | |
| MarkerTree::TRUE | |
| } else { | |
| requirement.marker.only_extras() | |
| }; | |
| if requirement.marker == MarkerTree::FALSE { | |
| return Either::Left(std::iter::once(requirement)); | |
| } | |
| let extra_marker = requirement.marker.only_extras(); |
| @@ -479,9 +471,6 @@ impl HashStrategy { | |||
| let mut hashes = None; | |||
|
|
|||
| for requirement in requirements { | |||
There was a problem hiding this comment.
[P2] An inactive URL hash can authorize a transitive archive
The initial --require-hashes pass skips requirements whose markers are always false. When resolve passes those requirements to augment_hashes, this loop adds their URL-fragment digests to the allowlist. A wheel selected by direct URL can then name the same archive in its dependency metadata, allowing uv to build or install bytes matching the inactive digest even though no active requirement or constraint authorized them.
| for requirement in requirements { | |
| for requirement in requirements { | |
| if requirement.marker.is_false() { | |
| continue; | |
| } |
Continues #23257, reverted in #23373. See the [original review](#23257 (review)). Parse PEP 825's `variant_label`, `variant_namespaces`, `variant_features`, and `variant_properties` in named dependency specifiers. Notably, we don't evaluate the markers yet, but uv won't error (with or without preview) when observing them, allowing packages to have wheel variants and variant information in `METADATA` even if uv won't install those variants yet. For now, `variant_label` is `''` everywhere, including on variant wheels. This means `foo; variant_label == ''` always applies. The three variant sets are empty, so `"nvidia" in variant_namespaces` is false and `"nvidia" not in variant_namespaces` is true. Evaluation against the declaring wheel's label and compatible properties is deferred. The parser rejects ordered comparisons (`<`, `<=`, `>`, `>=`) on `variant_label`. For a path or URL with a variant marker, require `name @ <url>` so uv can apply overrides without building the source to discover its name. The resolver resolves variant predicates before constructing forks. --------- Co-authored-by: konstin <[email protected]>
Reverts #23257, which was accidentally merged.