Repository navigation
perf(specifiers): push PEP 440 logic into the range engine - #1259
Merged
Merged
Conversation
notatallshaw
force-pushed
the
pep440-logic-to-ranges
branch
from
June 13, 2026 17:41
3b3bac4 to
5a9b7f9
Compare
notatallshaw
force-pushed
the
pep440-logic-to-ranges
branch
from
June 13, 2026 17:45
5a9b7f9 to
d6b0dc5
Compare
Member
Author
|
This is ready for review. I put a lot of effort into making sure no scenario significantly regressed in performance, even for a tradeoff of some scenarios significantly improving in performance. I have achieved that, worst regression is only a few percent, I intend to keep these performance numbers for the public |
notatallshaw
marked this pull request as ready for review
June 13, 2026 17:53
henryiii
approved these changes
Jun 15, 2026
henryiii
left a comment
Contributor
There was a problem hiding this comment.
I ran Kimi K2.7 code on it for review, it didn't find anything.
ðĪ Kimi K2.7-code review
The review completed with no bugs found and a recommendation to approve.
Key points:
- The refactor in
specifiers.py/_ranges.pyis internally consistent. resolve_prereleasesis behaviorally equivalent to the previous inline logic.coerce_versiongoing from private to internal-public is acceptable since_ranges.pyis still private to the package.bounds_for_speccorrectly leaves===handling to callers.- One test mutates
ss._ranges = ()as a white-box âpoisoningâ check; thatâs intentional but couples the test to internal state. - Minor nit: the test name
test_specifierset_contains_reads_cached_boundsis slightly misleading becausecontainstries_fast_matchbefore falling back to cached bounds.
No code changes are required unless you want to rename that test. Let me know if youâd like me to do that.
This looks good to me.
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.
Towards #1182
This pushes most of the special PEP 440 logic handling down into the range engine, so that
VersionRangeandSpecifierSetwill share the same core logic.