Skip to content

Represent Python build names in managed installation keys - #2030

Draft
ewdurbin wants to merge 3 commits into
mainfrom
python-build-names/01-managed-identity
Draft

ewdurbin wants to merge 3 commits into
mainfrom
python-build-names/01-managed-identity

Conversation

@ewdurbin

Copy link
Copy Markdown
Collaborator

Summary

Represent publisher-defined build names as part of managed Python installation identity. Normalize user-provided names to lowercase and restrict names to [a-z][a-z0-9_]*.

Keep Python variants distinct from build names and use named and unnamed build terminology throughout key parsing, display, ordering, and tests.

Stack: 1 of 7.

Test plan

  • cargo fmt --all --check
  • cargo test --locked -p uv-python
  • Focused build-name and build-revision integration tests
  • Native and Windows workspace Clippy

@astral-automations-bot astral-automations-bot Bot added area:uv-python Related to the uv python interface enhancement New feature or request labels Sep 22, 2026
@ewdurbin
ewdurbin added this pull request to stack #2038 September 22, 2026 18:01
@codspeed

codspeed Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 54 untouched benchmarks
⏩ 35 skipped benchmarks1


Comparing python-build-names/01-managed-identity (95038b6) with main (72ceca3)2

Open in CodSpeed

Footnotes

  1. 35 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (f3e56e1) during the generation of this report, so 72ceca3 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@zaniebot zaniebot added risk:3 Credible risk of meaningful incorrect behavior or regression; bounded or recoverable. priority:2 Important: bounded correctness, release reliability, committed work, or proven performance gains. size:3 Substantial: interacting behaviors, difficult compatibility questions, or a careful migration. labels Sep 23, 2026
@ewdurbin
ewdurbin force-pushed the python-build-names/01-managed-identity branch from ff81b62 to 65fe403 Compare September 24, 2026 20:53
@astral-automations-bot
astral-automations-bot Bot force-pushed the python-build-names/01-managed-identity branch from 24347a1 to 3e1a356 Compare September 28, 2026 16:08
@ewdurbin
ewdurbin force-pushed the python-build-names/01-managed-identity branch from 3e1a356 to 206514f Compare September 28, 2026 18:57
@astral-automations-bot
astral-automations-bot Bot force-pushed the python-build-names/01-managed-identity branch 4 times, most recently from 1402f0e to 391cdce Compare October 8, 2026 02:05
Comment thread crates/uv-python-managed/src/managed.rs Outdated
Comment on lines +1280 to +1286
let mut custom = default.clone();
custom.key = custom
.key
.with_build_name(PythonBuildName::from_str("custom").unwrap());

assert!(!custom.is_upgrade_of(&default));
assert!(!default.is_upgrade_of(&custom));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P3] Exercise an otherwise valid upgrade in the build-name test

Both installations are 3.10.8 with no build revision, so both assertions still pass if the build-name guard is removed: the existing same-version logic already returns false. This duplicates test_is_upgrade_of_same_version without protecting the new invariant. Give the candidate a newer patch or build revision, verify that matching build names permit the upgrade, then verify that differing names prevent it.

Comment on lines +163 to +165
fn executable_name_variant_suffix(&self) -> String {
self.variant.executable_suffix().to_string()
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P3] Keep executable variant suffixes borrowed

PythonVariant::executable_suffix() already returns &'static str. This wrapper adds a temporary heap allocation for every nonempty suffix, which all three executable-name formatters immediately interpolate and discard. It introduces no build-name-specific behavior. Retain the direct calls to the existing helper, or return the borrowed suffix here.

@zaniebot
zaniebot deployed to automations October 8, 2026 23:41 — with GitHub Actions Active
ewdurbin and others added 3 commits October 23, 2026 14:39
Represent publisher-defined build names as part of managed Python installation identity. Normalize user-provided names to lowercase and restrict names to `[a-z][a-z0-9_]*`.

Keep Python variants distinct from build names and use named and unnamed build terminology throughout key parsing, display, ordering, and tests.
@astral-automations-bot
astral-automations-bot Bot force-pushed the python-build-names/01-managed-identity branch from 95038b6 to 2b1759b Compare October 23, 2026 14:43

This branch was successfully deployed

1 active (outdated) deployment
automations — 95038b6b Deployed Oct 8, 2026 by zaniebot via review-code-quality / code quality review #8612
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:uv-python Related to the uv python interface enhancement New feature or request priority:2 Important: bounded correctness, release reliability, committed work, or proven performance gains. risk:3 Credible risk of meaningful incorrect behavior or regression; bounded or recoverable. size:3 Substantial: interacting behaviors, difficult compatibility questions, or a careful migration.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants