Skip to content

Conversation

@Avasam
Copy link
Contributor

@Avasam Avasam commented Nov 28, 2023

Summary of changes

This was noticed in https://github.com/python/typeshed/pull/10058/files#diff-1acb87d31f86c216cde10127dbe27643bd9d83975a757d3fe75559c03fd9b934

This change allows users to use these Protocols in static-type-checking to ensure proper usage of any class implementing these Interfaces.

Doesn't close any open issue, but relates to/work towards #2345

Pull Request Checklist

@Avasam Avasam force-pushed the pkg_resources-invalid-protocols branch from dbc0eb4 to 2f7156d Compare November 28, 2023 20:57
@Avasam Avasam force-pushed the pkg_resources-invalid-protocols branch from 2f7156d to f73efcc Compare November 28, 2023 21:16
@Avasam Avasam mentioned this pull request Jan 12, 2024
2 tasks


class IResourceProvider(IMetadataProvider):
class IResourceProvider(IMetadataProvider, Protocol):
Copy link
Member

Choose a reason for hiding this comment

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

Today I learned about extending protocols. Nice work.


class IMetadataProvider:
def has_metadata(name):
class IMetadataProvider(Protocol):
Copy link
Member

Choose a reason for hiding this comment

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

I have no idea if these protocols are used anywhere (such as with Zope), but I suspect not. If this change ends up causing unexpected disruption, we may have to back it out. Thanks for making it a separate PR.

@jaraco jaraco merged commit 04a6bfe into pypa:main Jan 24, 2024
@Avasam Avasam deleted the pkg_resources-invalid-protocols branch January 24, 2024 18:58
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