Skip to content

feat: add a key argument to SpecifierSet.filter()#1068

Merged
henryiii merged 5 commits intopypa:mainfrom
frostming:frostming/issue1066
Jan 23, 2026
Merged

feat: add a key argument to SpecifierSet.filter()#1068
henryiii merged 5 commits intopypa:mainfrom
frostming:frostming/issue1066

Conversation

@frostming
Copy link
Copy Markdown
Contributor

Close #1066

Signed-off-by: Frost Ming [email protected]

@frostming frostming force-pushed the frostming/issue1066 branch from 6641730 to 104ebf9 Compare January 23, 2026 02:20
@frostming frostming force-pushed the frostming/issue1066 branch from 104ebf9 to dc58940 Compare January 23, 2026 02:25
Comment thread src/packaging/specifiers.py Outdated
Copy link
Copy Markdown
Contributor

@henryiii henryiii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the TYPE_CHECKING should be removed, overloads just get replaced at runtime anyway, but otherwise looks good to me, nicely typed.

@henryiii
Copy link
Copy Markdown
Contributor

I pushed a minor stylistic change to better match some other code.

Comment thread src/packaging/specifiers.py Outdated
Copy link
Copy Markdown
Member

@notatallshaw notatallshaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

It's annoying that type hinters don't validate the overload signatures against the body of the actual method. But this is the best way to represent the type signature.

@henryiii henryiii merged commit 7d4aade into pypa:main Jan 23, 2026
44 checks passed
@frostming frostming deleted the frostming/issue1066 branch January 26, 2026 01:27
This was referenced Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Consider adding a key argument to SpecifierSet.filter()

3 participants