-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Don't ignore missing stubs in setuptools #10058
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
Changes from 5 commits
ec253ca
b9495d8
e72ce69
f05d076
bdf18ca
4057ff6
d0485e8
6dfcf40
4e0db81
dc9ff1d
373dabb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Mock | ||
setuptools.msvc.winreg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Mock | ||
setuptools.msvc.winreg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
version = "67.6.*" | ||
|
||
[tool.stubtest] | ||
ignore_missing_stub = true | ||
# darwin is equivalent to linux for OS-specific methods | ||
platforms = ["linux", "win32"] |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -6,7 +6,7 @@ from abc import ABCMeta | |||||||||||||||||||||||||
from collections.abc import Callable, Generator, Iterable, Sequence | ||||||||||||||||||||||||||
from io import BytesIO | ||||||||||||||||||||||||||
from re import Pattern | ||||||||||||||||||||||||||
from typing import IO, Any, ClassVar, TypeVar, overload | ||||||||||||||||||||||||||
from typing import IO, Any, ClassVar, Protocol, TypeVar, overload, type_check_only | ||||||||||||||||||||||||||
from typing_extensions import Literal, Self, TypeAlias | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
_Version: TypeAlias = Incomplete # from packaging.version | ||||||||||||||||||||||||||
|
@@ -21,8 +21,8 @@ _PkgReqType: TypeAlias = str | Requirement | |||||||||||||||||||||||||
_DistFinderType: TypeAlias = Callable[[_Importer, str, bool], Generator[Distribution, None, None]] | ||||||||||||||||||||||||||
_NSHandlerType: TypeAlias = Callable[[_Importer, str, str, types.ModuleType], str] | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
def declare_namespace(name: str) -> None: ... | ||||||||||||||||||||||||||
def fixup_namespace_packages(path_item: str) -> None: ... | ||||||||||||||||||||||||||
def declare_namespace(packageName: str) -> None: ... | ||||||||||||||||||||||||||
def fixup_namespace_packages(path_item: str, parent=None) -> None: ... | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
class WorkingSet: | ||||||||||||||||||||||||||
entries: list[str] | ||||||||||||||||||||||||||
|
@@ -35,18 +35,24 @@ class WorkingSet: | |||||||||||||||||||||||||
def __iter__(self) -> Generator[Distribution, None, None]: ... | ||||||||||||||||||||||||||
def find(self, req: Requirement) -> Distribution | None: ... | ||||||||||||||||||||||||||
def resolve( | ||||||||||||||||||||||||||
self, requirements: Iterable[Requirement], env: Environment | None = None, installer: _InstallerType | None = None | ||||||||||||||||||||||||||
self, | ||||||||||||||||||||||||||
requirements: Iterable[Requirement], | ||||||||||||||||||||||||||
env: Environment | None = None, | ||||||||||||||||||||||||||
installer: _InstallerType | None = None, | ||||||||||||||||||||||||||
replace_conflicting=False, | ||||||||||||||||||||||||||
extras=None, | ||||||||||||||||||||||||||
) -> list[Distribution]: ... | ||||||||||||||||||||||||||
def add(self, dist: Distribution, entry: str | None = None, insert: bool = True, replace: bool = False) -> None: ... | ||||||||||||||||||||||||||
def subscribe(self, callback: Callable[[Distribution], object]) -> None: ... | ||||||||||||||||||||||||||
def subscribe(self, callback: Callable[[Distribution], object], existing=True) -> None: ... | ||||||||||||||||||||||||||
|
def subscribe(self, callback: Callable[[Distribution], object], existing=True) -> None: ... | |
def subscribe(self, callback: Callable[[Distribution], object], existing: bool = True) -> None: ... |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'll be the same as https://github.com/pypa/packaging/blob/55584fb5ca327ba38b74ca5c668125caaebd9a5d/src/packaging/requirements.py#L33
def __init__(self, requirement_string) -> None: ... | |
def __init__(self, requirement_string: str) -> None: ... |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def __lt__(self, other) -> bool: ... | |
def __le__(self, other) -> bool: ... | |
def __gt__(self, other) -> bool: ... | |
def __ge__(self, other) -> bool: ... | |
def __eq__(self, other) -> bool: ... | |
def __ne__(self, other) -> bool: ... | |
def __lt__(self, other: Distribution) -> bool: ... | |
def __le__(self, other: Distribution) -> bool: ... | |
def __gt__(self, other: Distribution) -> bool: ... | |
def __ge__(self, other: Distribution) -> bool: ... | |
def __eq__(self, other: object) -> bool: ... | |
def __ne__(self, other: object) -> bool: ... |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def activate(self, path: list[str] | None = None, replace=False) -> None: ... | |
def activate(self, path: list[str] | None = None, replace: bool = False) -> None: ... |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this class doesn't exist at runtime, should it maybe be private?
class IResourceManager(Protocol): | |
class _IResourceManager(Protocol): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that what @type_check_only
is for? Granted support is still limited in mypy (python/mypy#15146, python/mypy#9531)
The source docstrings do call it IResourceManager
, so it's the right name, makes it easier to find and import, whilst being safer with checkers that support the annotation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, mypy has been pretty slow to implement this feature :)
Elsewhere in typeshed, though, we generally don't rely on a feature unless it's supported by all major type checkers. We use @type_check_only
in a few places already, but those are basically all very special cases (builtins.pyi
, typing.pyi
) where our standard option of making the name private isn't available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.