-
Notifications
You must be signed in to change notification settings - Fork 81
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
Generate the Python stubs automatically #1661
Open
dgelessus
wants to merge
15
commits into
H-uru:master
Choose a base branch
from
dgelessus:python_interface_stub_generator
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d80ddfe
Add script for automatically generating the Python interface stubs
dgelessus 2fc74b6
Add Plasma enum support to stub generator
dgelessus 9ff5c34
Don't output empty class and property docstrings into stubs
dgelessus b095767
Disable stub module docstrings to avoid issues with __future__ imports
dgelessus bd396f7
Define a stable order for enum constants with equal values
dgelessus 82befd9
Fix Python glue docstrings with missing space after "Params:"
dgelessus 24c1bc4
Fix uncapitalized "false" in Python glue parameter defaults
dgelessus ed94fc5
Update C++ docstrings that got out of sync with stubs for no good reason
dgelessus 86184db
Fix assorted missing parameter lists and defaults in Python glue
dgelessus 123f196
Add type annotation support to stub generator
dgelessus e387f0a
Add existing type annotations from stubs to C++-defined docstrings
dgelessus 3ca8000
Add special case for Plasma needing an import of PlasmaConstants
dgelessus 4d9b832
Add missing period to C++-defined PtYesNoDialog docstring
dgelessus f725ba4
Regenerate Python stubs using generate_stubs.py
dgelessus a5e144f
Add default values for keyword arguments to PtDebugPrint docstrings
dgelessus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Previously this was -1, but I'm guessing it's handled as a uint internally so it keeps the positive value?
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 guess a good question is whether a comparison against -1 would ever work in Python, maybe this MAX_UINT32 is the only correct option
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.
Yeah, it's declared in C++ as
kGameJoinPending = (uint32_t)-1
, so it gets output as unsigned.Also worth noting that I used a 64-bit client to generate the stubs. Plasma's custom
EnumValue
s store the numeric value asPy_ssize_t
, so it's possible that a 32-bit client would see this constant as-1
on the Python side. That seems like something we should fix...