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

Enable sip pyi generated #3

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open

Enable sip pyi generated #3

wants to merge 19 commits into from

Conversation

echoix
Copy link
Owner

@echoix echoix commented Jan 5, 2025

Fixes #NNNN

@timrid
Copy link

timrid commented Jan 9, 2025

I like this proposal more than the one from here as it seems much more complete. I tested this briefly and noticed the following points:

1. Missing Constants
The most errors in my codebase are because of missing constants. Many constants are now moved to a subclass (which i generally like) but they are not a global variables any more. I think this is needed for backward compatiblity reasons.
image

2. Some methods not found
Some methods that are defined in python code and are dynamically added have no type hints. Eg. wx.Window.Bind.
image

3. Some functions are not correctly typed:
The type hints for functions that are defined in python code (eg wx.CallAfter) are wrong.
image

4. Setter of @property seems strange
Currently the setter of @property have mutliple arguments like this:

class Window(WindowBase):
...
    @property
    def Size(self) -> Size: ...
    @Size.setter
    def Size(self, x: int, y: int, width: int, height: int, sizeFlags: int = ...) -> None: ...
...

But they have to have only one argument like this:

class Window(WindowBase):
...
    @property
    def Size(self) -> Size: ...
    @Size.setter
    def Size(self, val: Size) -> None: ...
...

4. Missing documentation
The docstrings in the pyi files are missing.

@echoix
Copy link
Owner Author

echoix commented Jan 9, 2025

My goal here wasn't to replace the ones already there by the PI generator, but to add the info from the sip-generated ones into the PI generated ones (that's why in the PI generator, I make the classes be a subclass of the class from the one in the module extension). This allows to keep the same docstrings generated.

Thus, the methods defined in Python in the real py files (eg core.py), it is expected that they don't appear from sip-generated files.

@echoix
Copy link
Owner Author

echoix commented Jan 9, 2025

But your observation about properties is interesting

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