Do you have references? And regardless, someone needs to propose an update to the spec so that the interpretation I just described is clearly excluded. I’ll do it myself if there’s a clear consensus.
https://github.com/pypa/pip/issues/12469
https://discuss.python.org/t/handling-of-pre-releases-when-backtracking/40505/6
https://github.com/prefix-dev/rip/issues/118
https://github.com/astral-sh/uv/issues/1641#issuecomment-1951393681
I’m not sure there is a clear consensus because Poetry implements it according to how you just interpreted the spec (and how I’ve argued it reads in the past but I got very tired of making that case).
That would be the obvious intersection, not a union.
Thanks, copy and paste typo, I’ve fixed it.
Are you also interested in unions? If not, why not?
No, I’m not interested because you can’t specify unions in SpecifierSets, only intersections, i.e. you can’t make a Python packaging requirement with a union (e.g. <1
or >3
).
I do not think this is correct. Is your point intended to be that
<=2.0.0
excluded pre-releases? But that is not what the specs say, inclusive comparisons do not exclude pre-releases.
The term inclusive / exclusive is only meant to refer to the fact when a specifier version itself is a prerelease does it also imply it is looking at prereleases, and the only exclusive operator is the “!=”:
https://github.com/pypa/packaging/issues/776#issuecomment-1900515985
https://github.com/pypa/packaging/issues/788
https://github.com/pypa/packaging/pull/794
And even
<2.0.0
only excludes pre-releases of the specified version. So the intuitive<=1.0.0a1
is the correct intersection all along, no?
That is not how the spec is interpreted by packaging, poetry, or uv.
I think the correct values of unions and intersections are already implied by existing specifications
The spec very much does not say what you should do in the face of two specifiers, as discussed in https://discuss.python.org/t/handling-of-pre-releases-when-backtracking/40505
And the nuances that are already brought up by Paul in https://discuss.python.org/t/proposal-intersect-and-disjoint-operations-for-python-version-specifiers/71888/9 and myself in https://discuss.python.org/t/proposal-intersect-and-disjoint-operations-for-python-version-specifiers/71888/8 show that resolvers do not take the same approach when implicitly intersecting specifiers.
well I am about to demonstrate that this is true: because I cannot see how excluding
2.0a1
from>1.0
is justified. I do not see a way to read the specification to say that; but if you do then you do!
Because of the following line in the spec:
Pre-releases of any kind, including developmental releases, are implicitly excluded from all version specifiers