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

Set exact version specifiers when resolving from lockfile #5193

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions crates/uv-resolver/src/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use distribution_types::{
RemoteSource, Resolution, ResolvedDist, SourceDistCompatibility, ToUrlError, UrlString,
VersionId, WheelCompatibility,
};
use pep440_rs::{Version, VersionSpecifiers};
use pep440_rs::{Version, VersionSpecifier};
use pep508_rs::{
ExtraOperator, MarkerEnvironment, MarkerExpression, MarkerTree, VerbatimUrl, VerbatimUrlError,
};
Expand Down Expand Up @@ -2068,7 +2068,12 @@ impl Dependency {
// Reconstruct the `RequirementSource` from the `Source`.
let source = match &self.distribution_id.source {
Source::Registry(_) => RequirementSource::Registry {
specifier: VersionSpecifiers::empty(),
// We don't store the version specifier that was originally used for resolution in
// the lockfile, so this might be too restrictive. However, this is the only version
// we have the metadata for, so if resolution fails we will need to fallback to a
// clean resolve.
specifier: VersionSpecifier::equals_version(self.distribution_id.version.clone())
.into(),
index: None,
},
Source::Git(repository, git) => {
Expand Down
Loading