-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Added PyInstaller stubs for all documented modules & packages #8702
Conversation
https://pyinstaller.org/en/stable/usage.html https://pyinstaller.org/en/stable/hooks.html https://pyinstaller.org/en/stable/hooks-config.html https://pyinstaller.org/en/stable/advanced-topics.html https://github.com/pyinstaller/pyinstaller/blob/develop/PyInstaller/fake-modules/pyi_splash.py All `__all__` from documented modules & packages
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
def __init__( | ||
self, | ||
scripts: Iterable[StrOrBytesPath], | ||
pathex=..., | ||
binaries=..., | ||
datas=..., | ||
hiddenimports=..., | ||
hookspath=..., | ||
hooksconfig: dict[str, dict[str, object]] | None = ..., | ||
excludes=..., | ||
runtime_hooks=..., | ||
cipher=..., | ||
win_no_prefer_redirects: bool = ..., | ||
win_private_assemblies: bool = ..., | ||
noarchive: bool = ..., | ||
module_collection_mode=..., | ||
) -> None: ... |
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.
I'm confused about why pyright isn't emitting an error here. There's no entry in the pyrightconfig.stricter.json
exclude-list, so it should be erroring for any parameters that don't have a type 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.
Just a guess:
pyrightconfig.stricter.json
has "typeCheckingMode": "basic"
and doesn't configure reportMissingParameterType
. The default value for that setting being None
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.
No idea -- anyway, it's not your fault, and we certainly don't have a requirement that all parameters need to be annotated when first adding stubs :)
I'll look into it and try to work it out...
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
Thanks! Mostly looks good, but a few points below :) all are fairly minor!
My main concern is using LiteralString
for parameter annotations, which seems quite restrictive. Not sure about that.
Here's a batch of fixes from your comments, and a few discussion points. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
LGTM! Just needs a couple more allowlist entries. I'll apply them and then merge.
This comment has been minimized.
This comment has been minimized.
PyInstaller.utils.tests | ||
PyInstaller.utils.win32.* | ||
# Explicitly private implementation details | ||
PyInstaller\._.* |
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.
I like that this allowlist entry ends up looking like an emoji
This comment has been minimized.
This comment has been minimized.
1 similar comment
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Thanks @Avasam! :D |
stubgen
was timing out (python/mypy#9103), so I had to generate these stubs using Pyright rather thancreate_baseline_stubs.py
. Hopefully I didn't miss anything.ignore_missing_stub
set totrue
because most modules are not meant to be used, yet are not marked as private.Documented modules:
__all__
from documented modules & packagespyi_splash
is a fake module that only exists once the app is frozen. It is meant to manipulate the splash screen.