Proposal: Intersect and Disjoint Operations for Python Version Specifiers

Note that the final possibility is if the only available version *that satisfies the version specifier" is a pre-release. So if foo 1.0 and foo 2.0a1 exist, the standard says that foo>1.0 should pick foo 2.0a1. Your rules don’t do that.

This was discussed at length in previous discussions on discuss, and pip and uv github issues trackers. There are multiple ways you can read the different prerelease lines in the specification.

uv matches packaging here:

>>> from packaging.specifiers import SpecifierSet
>>> list(SpecifierSet('>1.0').filter(["1.0", "2.0a1"]))
[]

Edit: I realized I might be using the wrong interface and Specifier (rather than SpecifierSet) does behave how this line is interpreted:

>>> list(Specifier('>1.0').filter(["1.0", "2.0a1"]))
['2.0a1']

Which is interesting, because pip definetly doesn’t, I am going to do some further investigation here.