-
-
Notifications
You must be signed in to change notification settings - Fork 216
Polish stubs with deprecated decorator #2984
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
Polish stubs with deprecated decorator #2984
Conversation
|
I realized later that some checks check if the stubs are present, so I'll convert to draft, get some feedback and decide what to do with the PR |
ankith26
left a comment
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.
If you are doing this change, you need to add the removed API to the stubtest ignore file.
|
Alright, thanks, I didn't know that was possible, the checks are passing now. |
|
I would like to not do this. Deprecations are now part of the type system in 3.13: https://peps.python.org/pep-0702/ In my VS code deprecations show up like this: And it's backed by a pyi file that has the feature: (Using typing_extensions since I'm on 3.9) |
|
do we have some sort of access to @deprecated in the lower python supported version of pygame? I'm sorry for the person which got pinged 💀 I forgot the code block |
|
For now I added back everything adding a docstring for deprecation. Would be even better to use the deprecated decorator |
|
You can import |
oddbookworm
left a comment
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've just got a few clarifying suggestions
oddbookworm
left a comment
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!
ankith26
left a comment
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.
You missed the deprecation of mouse.set_system_cursor too
…pygame-ce into remove-deprecated-stubs
Thanks, going to add it in #2943 . |
hold on, I didn't know it was deprecated, I need to add it here aswell! |
ankith26
left a comment
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, thanks for the PR 🥳


After the discussion in this PR the focus of it has changed. This can be considered stubs polish.
_to/from_string_formatname to_to/from_bytes_formatas the previous was referring to deprecated functionsfinalimport fromwindow.pyiasWindowis not a final class anymoretyping_extension)@deprecateddecorator to note deprecated functions and classes. This makes the stubs stay up to date with the python type systems and add useful messages (and visual effects like a strikethrough in VSCode) about deprecated features so users don't confuse them with the correct ones and are able to know if something is deprecated without documentation/running the code.