-
Notifications
You must be signed in to change notification settings - Fork 253
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
Is there a canonical way of determining if two specifiers are mutually exclusive? #762
Comments
Hmmm, this works for a lot of cases: def check_conflict(spec_set1: "SpecifierSet", spec_set2: "SpecifierSet") -> bool:
for spec in spec_set1:
if spec_set2.contains(spec.version):
return True
return False
def mutually_exclusive_specifiers(
specifier_set1: "SpecifierSet", specifier_set2: "SpecifierSet"
) -> bool:
return not (
check_conflict(specifier_set1, specifier_set2)
or check_conflict(specifier_set2, specifier_set1)
) |
I'm very unsure about boundy conditions that include Python package versions are very complex, and with the various, pre, post, dev, alpha, beta, and rc versions, it's not clear to me the correct answer for these boundry conditions. My objective means for |
It occurs to me that it may not be statically possible to determine if 3 or more specifiers are mutually exclusive, at least in a reasonable amount of time, even if it's possible to determine if 2 specifiers are mutually exclusive. Firstly even if all 3 pairs of 3 specifiers are not mutually exclusive it does not proove that the 3 specifiers are not mutually exclusive, taking the example of the integers and normal mathematical operators: Every pair of this triplet is not mutually exclusive, but the three of them together are mutually exclusive. It's going to have to be enough to say either that a SpecifierSet is "mutually exclusive", is "not mutually exclusive", or "don't know". Given how much more complex this is than I thought it was, I am going to close this issue as there almost certainly isn't a "canonical" way of handeling this. I will raise specific issues like #766 as I find them. |
I'm working on a Pip optimization and I realize now that I misunderstand one of the expressions I had involving specifiers.
I am interested in understanding given two specifiers is there a canonical way of determining if two specifiers are mutually exclusive? e.g.
SpecifierSet('==1.21.6')
is mutually exclusive withSpecifierSet('>=1.22.3')
The text was updated successfully, but these errors were encountered: