Skip to content

Allow requiring metadata range requests - #21352

Merged
zanieb merged 2 commits into
mainfrom
zb/require-metadata-range-requests
Aug 28, 2026
Merged

zanieb merged 2 commits into
mainfrom
zb/require-metadata-range-requests

Conversation

@astral-automations-bot

Copy link
Copy Markdown
Contributor

Wheel metadata lookup normally falls back to streaming the entire wheel when HTTP range requests are unsupported. Add a hidden UV_REQUIRE_METADATA_RANGE_REQUESTS control that turns this fallback into an explicit error, allowing callers and integration tests to require the range path without parsing human-readable logs. Include focused client coverage for the opt-in behavior while preserving the existing default.

@astral-automations-bot astral-automations-bot Bot added internal A refactor or improvement that is not user-facing internal:testing Internal testing of behavior labels Aug 28, 2026
@zanieb

zanieb commented Aug 28, 2026

Copy link
Copy Markdown
Member

I want this for #21350 but it also seems like it could be generally useful

Comment thread crates/uv-static/src/env_vars.rs Resolved

/// Require wheel metadata to be fetched with HTTP range requests when separate metadata is
/// unavailable. If set to `true`, uv will fail instead of downloading the entire wheel.
#[attr_hidden]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't mind if we make this visible

@ewdurbin ewdurbin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

you already caught the only thing that stood out to me, which was the attr_added_in("next release") situation.

} else {
parse_boolish_environment_variable(EnvVars::UV_REQUIRE_METADATA_RANGE_REQUESTS)?
.unwrap_or(false)
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we... pass this in everywhere / set it, rather than parsing the env var in the client? :sick:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ugh, yes... I honestly just saw that it used parse_boolish_environment_variable and assumed it was in the right place, surprised uv-client has that... will fix

@zanieb
zanieb merged commit d9cd153 into main Aug 28, 2026
58 checks passed
@zanieb
zanieb deleted the zb/require-metadata-range-requests branch August 28, 2026 20:52
zanieb added a commit that referenced this pull request Aug 31, 2026
`UV_REQUIRE_METADATA_RANGE_REQUESTS` is currently parsed inside
`uv-client`, which makes client construction depend on ambient
environment state.

Parse it with `EnvironmentOptions`, map it to
`MetadataRangeRequest::{Fallback, Require}`, and pass it through
`BaseClientBuilder` to every registry client. This addresses [review
feedback](#21352 (comment)).

---------

Co-authored-by: Zanie Blue <[email protected]>

This branch was previously deployed

1 inactive deployment
automations — 1ceded8c Deployed Aug 28, 2026 by zanieb via review / security review #45444
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal:testing Internal testing of behavior internal A refactor or improvement that is not user-facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants