-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Report incompatible distributions to users #1293
Conversation
e323b62
to
ce013a8
Compare
dd9dfe5
to
691e3b0
Compare
ce013a8
to
1933d60
Compare
# Conflicts: # crates/puffin-resolver/src/candidate_selector.rs
90afb5e
to
b5da4ff
Compare
77cba18
to
48a5401
Compare
/// A [`Dist`] and metadata about it required for downstream filtering. | ||
#[derive(Debug, Clone)] | ||
pub struct DistMetadata { | ||
pub dist: Dist, | ||
|
||
/// The version of Python required by the distribution | ||
pub requires_python: Option<VersionSpecifiers>, | ||
|
||
/// Is the distribution file yanked? | ||
pub yanked: Yanked, | ||
} |
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.
Moved down; will be removed entirely in #1298
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.
This is such an amazing improvement to the error messages. What a win!
} | ||
|
||
/// Set the `exclude_newer` flag | ||
pub fn set_exclude_newer(&mut self) { |
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.
I might accept a yes: bool
parameter here. Or rename to enable_exclude_newer
. (I usually like the former since it's a little more flexible.)
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.
👍 it's going away in the next pull request and seems fine so I'll leave it for now but keep in mind for the future
(Self::Incompatible(t_self), Self::Incompatible(t_other)) => t_self.cmp(t_other), | ||
} | ||
} | ||
} |
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.
Nice. I looked at this a bit to see if I could find a way that it breaks the contract for Ord
, but nothing came to mind. :)
Extends the "compatibility" types introduced in #1293 to apply to source distributions as well as wheels. - We now track the most-relevant incompatible source distribution - Exclude newer, Python requirements, and yanked versions are all tracked as incompatibilities in the new model (this lets us remove `DistMetadata`!)
Instead of dropping versions without a compatible distribution, we track them as incompatibilities in the solver. This implementation follows patterns established in #1290.
This required some significant refactoring of how we track incompatible distributions. Notably:
Option<TagPriority>
is nowWheelCompatibility
which allows us to track the reason a wheel is incompatible instead of justNone
.Candidate
now has aCandidateDist
withCompatible
andIncompatibile
variants instead of justResolvableDist
; candidates are not strictly compatible anymoreResolvableDist
was renamed toCompatibleDist
IncompatibleWheel
was given an ordering implementation so we can track the "most compatible" (but still incompatible) wheel. This allows us to collapse the reason a version cannot be used to a single incompatibility.VersionMap
is retained, we still only store one incompatible wheel per version. This is sufficient for error reporting.TagCompatibility
type was added for tracking which part of a wheel tag is incompatibleCandidate::validate_python
moved toPythonRequirement::validate_dist
I am doing more refactoring in #1298 — I think a couple passes will be necessary to clarify the relationships of these types.
Includes improved error message snapshots for multiple incompatible Python tag types from #1285 — we should add more scenarios for coverage of behavior when multiple tags with different levels are present.