Skip to content

Use recorded member defaults for frozen sync - #22015

Merged
charliermarsh merged 1 commit into
charlie/lockfile-group-requires-pythonfrom
charlie/frozen-sync-member-defaults
Sep 30, 2026
Merged

charliermarsh merged 1 commit into
charlie/lockfile-group-requires-pythonfrom
charlie/frozen-sync-member-defaults

Conversation

@charliermarsh

@charliermarsh charliermarsh commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Summary

uv sync --package member uses the selected member's default dependency groups, but adding --frozen makes us use the defaults of the project we're running from instead.

For example, when run from a workspace root whose defaults are ["dev"], we select dev even if the requested member's defaults are ["docs"]. The same package selection can therefore install different dependencies depending on whether you pass --frozen.

For revision 5 and later lockfiles, frozen sync uses the selected member's recorded default groups and group Python requirements, including when the member's manifest is missing.

@astral-sh-bot

This comment has been minimized.

@charliermarsh
charliermarsh force-pushed the charlie/frozen-sync-member-defaults branch from 3539d81 to 614843f Compare September 28, 2026 01:28
@charliermarsh
charliermarsh force-pushed the charlie/frozen-sync-member-defaults branch from 614843f to 7d2fcf5 Compare September 28, 2026 14:25
@charliermarsh charliermarsh changed the title Use selected member defaults for frozen sync Use recorded member defaults for frozen sync Sep 28, 2026
@charliermarsh
charliermarsh changed the base branch from main to charlie/lockfile-default-groups September 28, 2026 14:25
@charliermarsh
charliermarsh force-pushed the charlie/frozen-sync-member-defaults branch from 7d2fcf5 to b59b814 Compare September 28, 2026 14:57
@charliermarsh
charliermarsh force-pushed the charlie/frozen-sync-member-defaults branch from b59b814 to 4990821 Compare September 28, 2026 16:07
@charliermarsh
charliermarsh force-pushed the charlie/frozen-sync-member-defaults branch from 4990821 to 1012024 Compare September 28, 2026 16:11
@charliermarsh
charliermarsh force-pushed the charlie/frozen-sync-member-defaults branch from 1012024 to 35ba38e Compare September 28, 2026 16:16
@charliermarsh
charliermarsh force-pushed the charlie/frozen-sync-member-defaults branch from 35ba38e to e549ddd Compare September 28, 2026 17:19
@charliermarsh
charliermarsh changed the base branch from charlie/lockfile-default-groups to charlie/lockfile-group-requires-python September 28, 2026 17:20
@charliermarsh
charliermarsh force-pushed the charlie/frozen-sync-member-defaults branch from e549ddd to 90ebf9a Compare September 28, 2026 17:30
@charliermarsh
charliermarsh force-pushed the charlie/frozen-sync-member-defaults branch from 90ebf9a to e31f4d4 Compare September 28, 2026 17:42
@charliermarsh
charliermarsh force-pushed the charlie/frozen-sync-member-defaults branch from e31f4d4 to 3312e7d Compare September 28, 2026 17:51
@charliermarsh
charliermarsh force-pushed the charlie/frozen-sync-member-defaults branch from 96e40ca to 7d9860a Compare September 29, 2026 17:26
@charliermarsh
charliermarsh force-pushed the charlie/frozen-sync-member-defaults branch from 7d9860a to d3205c4 Compare September 29, 2026 17:36
@charliermarsh
charliermarsh force-pushed the charlie/frozen-sync-member-defaults branch from d3205c4 to 57e4805 Compare September 29, 2026 17:37
@charliermarsh
charliermarsh force-pushed the charlie/frozen-sync-member-defaults branch from 57e4805 to 951273d Compare September 29, 2026 18:06
@charliermarsh
charliermarsh force-pushed the charlie/frozen-sync-member-defaults branch from 951273d to 9d196b8 Compare September 29, 2026 18:09
Comment thread crates/uv/src/commands/project/mod.rs Resolved
Comment thread crates/uv/src/commands/project/mod.rs Outdated
Comment on lines +627 to +647
let selected = lock
.member_group_metadata()
.into_iter()
.flatten()
.filter(|(member, _)| {
target.roots().any(|root| root == *member) || target.group_root(groups) == Some(*member)
})
.flat_map(|(member, metadata)| {
metadata
.iter()
.filter(move |(group, _)| target.includes_group(Some(member), group, groups))
.filter_map(move |(group, metadata)| {
metadata.requires_python.as_ref().map(|requires_python| {
(
(member.clone(), Some(group.clone())),
requires_python.clone(),
)
})
})
})
.collect::<RequiresPythonSources>();

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.

Maybe it's just because I'm not reviewing with an LSP to see the types, but I'm having a really hard time groking this transformation. It may benefit from a couple inline comments.

@charliermarsh
charliermarsh force-pushed the charlie/frozen-sync-member-defaults branch from 48f3e10 to 7a1d149 Compare September 29, 2026 20:24
Comment thread crates/uv/src/commands/project/mod.rs Outdated
Comment on lines +691 to +704
source,
PythonRequirementSource::Workspace(workspace, groups),
)
}

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.

Why are we retaining this interface if it's a trivial wrapper?

Comment thread crates/uv/src/commands/project/mod.rs Outdated
}

/// Validate an interpreter against a requirement and report its conflicting sources.
fn validate_python_requirement(

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.

Nit since the validator function is preexisting, but it might be nice to try to require validatation by construction in a follow-up

Comment on lines +2057 to +2060
The following requirements in `uv.lock` do not permit this version:
- lockfile: >=3.13
- member:docs: >=3.14
Use `uv python pin` to update the `.python-version` file to a compatible version

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.

aside: This rendering is... crazy? Why isn't this indented? Why isn't "Use uv python pin" a hint: sigh

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 will look at this)

@codspeed

codspeed Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 72 untouched benchmarks
⏩ 28 skipped benchmarks1


Comparing charlie/frozen-sync-member-defaults (cfa752b) with main (6049c56)

Open in CodSpeed

Footnotes

  1. 28 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. ↩

This branch was previously deployed

1 inactive deployment
automations — cfa752b9 Deployed Sep 30, 2026 by charliermarsh via review / security review #48375
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants