Skip to content

Avoid using new _typeshed protocol in pkg_resources for now #11909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions stubs/setuptools/pkg_resources/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import types
import zipimport
from _typeshed import Incomplete, StrPath, Unused
from _typeshed.importlib import LoaderProtocol
from collections.abc import Callable, Generator, Iterable, Iterator, Sequence
from io import BytesIO
from itertools import chain
Expand All @@ -13,6 +12,10 @@ from zipfile import ZipInfo

from ._vendored_packaging import requirements as packaging_requirements, version as packaging_version

# TODO: Use _typeshed.importlib.LoaderProtocol once mypy has included it in its vendored typeshed
class _LoaderProtocol(Protocol):
def load_module(self, fullname: str, /) -> types.ModuleType: ...

_T = TypeVar("_T")
_D = TypeVar("_D", bound=Distribution)
_NestedStr: TypeAlias = str | Iterable[_NestedStr]
Expand Down Expand Up @@ -360,7 +363,7 @@ def evaluate_marker(text: str, extra: Incomplete | None = None) -> bool: ...
class NullProvider:
egg_name: str | None
egg_info: str | None
loader: LoaderProtocol | None
loader: _LoaderProtocol | None
module_path: str | None

def __init__(self, module: _ModuleLike) -> None: ...
Expand Down