Skip to content
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

PyInstaller: Complete types in build_main.pyi #13528

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Sabfo
Copy link
Contributor

@Sabfo Sabfo commented Feb 23, 2025

Complete the incomplete types of Analysis class constructor params.

Complete the incomplete types of Analysis class constructor params.

This comment has been minimized.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Don't forget to add instance attributes to Analysis class, not just __init__ params.

Add annotations for instance attributes.
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@Sabfo Sabfo requested a review from sobolevn February 23, 2025 20:36
hookspath: list[tuple[StrPath, int]]
excludes: list[str]
custom_runtime_hooks: list[StrPath]
module_collection_mode: dict[str, Literal["pyz", "pyc", "py", "pyz+py", "py+pyz"]]
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to have this as

Suggested change
module_collection_mode: dict[str, Literal["pyz", "pyc", "py", "pyz+py", "py+pyz"]]
module_collection_mode: dict[str, str]

Literal types are hard :)

cipher: _PyiBlockCipher = None,
win_no_prefer_redirects: bool = False,
win_private_assemblies: bool = False,
noarchive: bool = False,
module_collection_mode: Incomplete | None = None,
# https://pyinstaller.org/en/stable/hooks.html#hook-global-variables
module_collection_mode: dict[str, Literal["pyz", "pyc", "py", "pyz+py", "py+pyz"]] | None = None,
Copy link
Member

Choose a reason for hiding this comment

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

Here we need to use dict[str, str], because it is hard to infer dict[str, Literal] type.

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