Skip to content

Conversation

@Avasam
Copy link
Collaborator

@Avasam Avasam commented Dec 18, 2025

Pulled directly from https://github.com/pypa/setuptools/pull/5021/files . But with an extra effort to try and use a dict-like protocol instead of a dict as parameter.

setuptools contributions have been stalling in the past year, thought I'd be done with it sooner. So I'm adding these here to for more parameters autocomplete and more flexible parameter types.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

Just one nit below, LGTM apart from that.

__version__: str

@type_check_only
class _DictLike(Protocol[_KT, _VT_co]): # type: ignore[misc] # Covariant type as parameter
Copy link
Collaborator

@srittau srittau Dec 19, 2025

Choose a reason for hiding this comment

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

Ironically and coincidentally, this is very similar to the MappingLike protocol I just suggested in #15152. (Although we need this protocol here for now anyway, even if the former gets merged, until these definitions have made their way into all relevant type checkers.)

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@Avasam Avasam requested a review from srittau December 20, 2025 01:02
@srittau srittau merged commit 06ecffc into python:main Dec 20, 2025
48 checks passed
@Avasam Avasam deleted the Fully-typed-setuptools-setup-method branch December 20, 2025 12:39
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.

2 participants