Skip to content

Revert "Parse wheel variant dependency markers" - #23373

Merged
konstin merged 1 commit into
mainfrom
konsti/revert-23257
Nov 23, 2026
Merged

konstin merged 1 commit into
mainfrom
konsti/revert-23257

Conversation

@konstin

@konstin konstin commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Reverts #23257, which was accidentally merged.

@konstin
konstin merged commit d99121a into main Nov 23, 2026
65 checks passed
@konstin
konstin deleted the konsti/revert-23257 branch November 23, 2026 21:43
Comment on lines +99 to +103
let extra_marker = if requirement.marker.is_false() {
MarkerTree::TRUE
} else {
requirement.marker.only_extras()
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Suggested change
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 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Suggested change
for requirement in requirements {
for requirement in requirements {
if requirement.marker.is_false() {
continue;
}

konsti-openai pushed a commit that referenced this pull request Dec 1, 2026
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]>
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.

1 participant