SpecifierSet.filter should allow pre-release when no final version matches specifiers, same as Specifier.filter#872
Conversation
6234741 to
4ed82fd
Compare
|
FWIW, I prefer writing a method to return early, and not have large else blocks, but this PR focuses on fixing the bug without refactoring or writing code that conflicts with the existing style. |
ad6d156 to
7865467
Compare
|
I've updated the tests of both |
6a04147 to
8bc9a3b
Compare
|
This is ready for review / merge. FYI the relevant line in the spec is:
|
|
I'm pinging just to check this is on someone's queue @brettcannon @pradyunsg @uranusjr as you all approved my last pre-release related PR #794, no rush to review or respond. I believe that this is a blocker for writing a correct CDCL or CDNL (such as pubgrub) Python packaging resolver that is spec-compliant. This PR is also motivating my work on pypa/pip#13221. I will be at the Packaging Summit at PyCon US 2025 in a couple of weeks if any questions would better be resolved in real life if any of you are there. |
|
This PR is superseded by #897, if accepted. |
Fixes #856
This brings
SpecifierSetin-line withSpecifierand the spec. I believe this behavior was incorrectly created from #29, which determined ahead of filtering whether to allow pre-releases or not, but did not introduce a fallback when only pre-releases matched the specifiers.Interestingly, even though the old behavior is listed in the doc string there were previously no tests for this behavior:
The docstring has been updated and the equivalent tests are added.