Uh oh!
There was an error while loading. Please reload this page.
Don't ignore missing stubs in setuptools - #10058
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
| def __enter__(self) -> None: ... | ||
| def __exit__(self, _exc_type, _exc_value, _traceback) -> None: ... |
There was a problem hiding this comment.
These are unannotated, but I don't think that should imply None since the body is just ....
There was a problem hiding this comment.
Is it fine if all setuptool classes that implement the EditableStrategy protocol have the same return type for their methods? (None for __call__ and __exit__, Self for __enter__)
There was a problem hiding this comment.
Maybe for __exit__, but it feels too restrictive for __enter__.
| path_entries: Incomplete | ||
| def __init__(self, dist: Distribution, name: str, path_entries: list[Path]) -> None: ... | ||
| def __call__(self, wheel: _WheelFile, files: list[str], mapping: dict[str, str]): ... | ||
| def __enter__(self): ... |
There was a problem hiding this comment.
| def__enter__(self): ... | |
| def__enter__(self)->Self: ... |
(Plus import)
| build_lib: Incomplete | ||
| def __init__(self, dist: Distribution, name: str, auxiliary_dir: _Path, build_lib: _Path) -> None: ... | ||
| def __call__(self, wheel: _WheelFile, files: list[str], mapping: dict[str, str]): ... | ||
| def __enter__(self): ... |
There was a problem hiding this comment.
| def__enter__(self): ... | |
| def__enter__(self)->Self: ... |
| __all__ = ["Require", "find_module", "get_module_constant", "extract_constant"] | ||
| def find_module(module, paths=None) -> tuple[IO[Any], str, tuple[str, Literal["", "r", "rb"], Literal[7, 6, 1, 2, 3, -1]]]: ... |
There was a problem hiding this comment.
| deffind_module(module, paths=None) ->tuple[IO[Any], str, tuple[str, Literal["", "r", "rb"], Literal[7, 6, 1, 2, 3, -1]]]: ... | |
| deffind_module(module, paths=None) ->tuple[IO[Any], str|None, tuple[str, Literal["", "r", "rb"], Literal[7, 6, 1, 2, 3, -1]]]: ... |
I see some paths where it's None.
| requirements: Iterable[Requirement], | ||
| env: Environment | None = None, | ||
| installer: _InstallerType | None = None, | ||
| replace_conflicting=False, |
There was a problem hiding this comment.
| replace_conflicting=False, | |
| replace_conflicting: bool=False, |
| ) -> 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: ... |
There was a problem hiding this comment.
| defsubscribe(self, callback: Callable[[Distribution], object], existing=True) ->None: ... | |
| defsubscribe(self, callback: Callable[[Distribution], object], existing: bool=True) ->None: ... |
| # TODO: change this to packaging.markers.Marker | None once we can import | ||
| # packaging.markers | ||
| marker: Incomplete | None | ||
| def __init__(self, requirement_string) -> None: ... |
There was a problem hiding this comment.
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: ... |
| 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: ... |
There was a problem hiding this comment.
| 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: ... |
| @classmethod | ||
| def from_filename(cls, filename: str, metadata: _MetadataType = None, **kw: str | None | int) -> Distribution: ... | ||
| def activate(self, path: list[str] | None = None) -> None: ... | ||
| def activate(self, path: list[str] | None = None, replace=False) -> None: ... |
There was a problem hiding this comment.
| defactivate(self, path: list[str] |None=None, replace=False) ->None: ... | |
| defactivate(self, path: list[str] |None=None, replace: bool=False) ->None: ... |
| class IResourceManager: | ||
| @type_check_only | ||
| class IResourceManager(Protocol): |
There was a problem hiding this comment.
If this class doesn't exist at runtime, should it maybe be private?
| classIResourceManager(Protocol): | |
| class_IResourceManager(Protocol): |
There was a problem hiding this comment.
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.
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.
…ignore-missing-stubs-in-setuptools
This comment has been minimized.
This comment has been minimized.
Avasam
commented
Apr 29, 2023
Oh neat, you can request review from more than one person now on GitHub. |
This comment has been minimized.
This comment has been minimized.
Pretty sure pyright is failing here because |
AlexWaygood
commented
May 1, 2023
Seems your diagnosis was spot on! |
This comment has been minimized.
This comment has been minimized.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
JelleZijlstra
commented
May 19, 2023
Looks good, @AlexWaygood any further feedback? @Avasam feel free to mark conversations as "resolved" if you have addressed them. |
There was a problem hiding this comment.
Haven't reviewed in depth, but all my previous points have been addressed, nothing stands out as weird from a skim-read, and I trust @JelleZijlstra to do a thorough review :)
There was a problem hiding this comment.
Haven't reviewed in depth, but all my previous points have been addressed, nothing stands out as weird from a skim-read, and I trust @JelleZijlstra to do a thorough review :)
#10057 (comment)
ignore_missing_stub = true__all__