Skip to content
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

universal-lock: track version numbers for all distributions #3356

Closed
Tracked by #3347
BurntSushi opened this issue May 3, 2024 · 0 comments
Closed
Tracked by #3347

universal-lock: track version numbers for all distributions #3356

BurntSushi opened this issue May 3, 2024 · 0 comments
Assignees
Labels
preview Experimental behavior

Comments

@BurntSushi
Copy link
Member

When creating a Lock, we currently have a todo!() when trying to extract version numbers:

let version = match resolved_dist.version_or_url() {
VersionOrUrl::Version(v) => v.clone(),
// TODO: We need a way to thread the version number for these
// cases down into this routine. The version number isn't yet in a
// `ResolutionGraph`, so this will require a bit of refactoring.
VersionOrUrl::Url(_) => todo!(),
};

For example, when the distribution comes from a direct URL, it only has a URL and not a version number:

impl DistributionMetadata for DirectUrlBuiltDist {
fn version_or_url(&self) -> VersionOrUrl {
VersionOrUrl::Url(&self.url)
}
}

My understanding is that a version number exists for these distributions in their metadata, but we currently don't keep it around (I believe). We need the version number for our universal lock file, as part of #3347.

@BurntSushi BurntSushi added the preview Experimental behavior label May 6, 2024
@charliermarsh charliermarsh self-assigned this May 14, 2024
charliermarsh added a commit that referenced this issue May 14, 2024
## Summary

In `ResolutionGraph::from_state`, we have mechanisms to grab the hashes
and metadata for all distributions -- but we then throw that information
away. This PR preserves it on a new `AnnotatedDist` (yikes, open to
suggestions) that wraps `ResolvedDist` and includes (1) the hashes
(computed or from the registry) and (2) the `Metadata23`, which lets us
extract the version.

Closes #3356.

Closes #3357.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Experimental behavior
Projects
None yet
Development

No branches or pull requests

2 participants