Repository navigation
Avoid cloning resolver metadata for virtual package nodes #22565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
16ba6b1
Avoid cloning resolver metadata for virtual package nodes
zanieb 10fdaf4
Avoid cloning distribution metadata for lock serialization
zaniebot 8ad6970
Remove the extra membership cache
zaniebot 43b0c7a
Use `FirstParty` for metadata path handling
zanie-oai 2a5e5bc
Distinguish project, workspace member, and dependency roles
zanie-oai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Avoid cloning distribution metadata for lock serialization
- Loading branch information
commit 10fdaf4efb19428a96d12b78bd3a335b136ca2c2
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| use std::borrow::Cow; | ||
| use std::fmt::Display; | ||
| use std::sync::Arc; | ||
|
|
||
|
|
@@ -46,8 +45,8 @@ impl PackageNodeKind { | |
| } | ||
|
|
||
| /// A pinned package with its resolved distribution and metadata. The [`ResolvedDist`] refers to a | ||
| /// specific distribution (e.g., a specific wheel), while the [`Metadata23`] refers to the metadata | ||
| /// for the package-version pair. | ||
| /// specific distribution (e.g., a specific wheel), while the [`Metadata`] describes | ||
| /// the package-version pair. | ||
| #[derive(Debug, Clone)] | ||
| pub struct AnnotatedDist { | ||
| pub dist: ResolvedDist, | ||
|
|
@@ -56,7 +55,8 @@ pub struct AnnotatedDist { | |
| pub kind: PackageNodeKind, | ||
| pub hashes: HashDigests, | ||
| pub metadata: Option<Arc<MetadataResponse>>, | ||
| pub is_workspace_member: bool, | ||
| /// Whether this distribution is the current project or a workspace member. | ||
| pub is_project_or_workspace_member: bool, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use an enum for this?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note, we should create a separate pull adding this to the code quality review |
||
| /// The "full" marker for this distribution. It precisely describes all | ||
| /// marker environments for which this distribution _can_ be installed. | ||
| /// That is, when doing a traversal over all of the distributions in a | ||
|
|
@@ -77,21 +77,6 @@ impl AnnotatedDist { | |
| }) | ||
| } | ||
|
|
||
| /// Returns the resolved metadata with local path preferences preserved for lock serialization. | ||
| pub fn metadata_for_lock(&self) -> Option<Cow<'_, Metadata>> { | ||
| let metadata = self.metadata()?; | ||
|
|
||
| // We normally write dependency paths relative to the lockfile. For the current project and | ||
| // workspace members, preserve the user's choice of relative or absolute paths instead. | ||
| // Metadata from `tool.uv.dependency-metadata` already preserves that choice. | ||
| // Only change this copy, not shared metadata. | ||
| if self.is_workspace_member { | ||
| Some(Cow::Owned(metadata.clone().with_force_relative(false))) | ||
| } else { | ||
| Some(Cow::Borrowed(metadata)) | ||
| } | ||
| } | ||
|
|
||
| /// Returns `true` if the [`AnnotatedDist`] is a base package (i.e., not an extra or a | ||
| /// dependency group). | ||
| pub(crate) fn is_base(&self) -> bool { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use an enum for this?