Scope VersionRange filter of pre-releases to a region so it complies with set algebra#1304
Closed
notatallshaw wants to merge 2 commits into
Closed
Scope VersionRange filter of pre-releases to a region so it complies with set algebra#1304notatallshaw wants to merge 2 commits into
notatallshaw wants to merge 2 commits into
Conversation
300baa7 to
222750c
Compare
A complement is an exclusion and grants no opt-in, so a & ~b no longer admits a pre-release that only the excluded b named. complement drops the region; difference keeps only the minuend's. Involution holds on the version set, not the opt-in region.
Member
Author
|
This still ends up leaking pre-releases in unexpected places. I have another idea but I'm going to work on it for a bit. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When I designed
VersionRangeI modeled pre-releases the same way they work inSpecifierSets, but this leads to edge cases under different set operations that don't work correctly (e.g. the example in #1298).This got me thinking that we could model the pre-release opt-in behavior as a range, instead of
True/False/None, so that pre-releases stay consistent under set algebra.In particular this now makes
a & ~b=a - beven for the pre-release policy, not just for the version set they represent.This does not impact
SpecifierSetoperations, which can only take the intersection of specifiers.A simple example is
>=1.0and>=2.0b1over the versions1.0,1.5b1,2.0b1,2.5. Individually,>=1.0filters to1.0,2.5and>=2.0b1filters to2.0b1,2.5. Prior to this change the union of the two would filter the whole list to1.0,1.5b1,2.0b1,2.5; now it filters to1.0,2.0b1,2.5, as1.5b1was never opted in by>=1.0.This makes
VersionRangecomply with many more set algebra rules without needing a caveat about pre-release policy.