-
-
Notifications
You must be signed in to change notification settings - Fork 169
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
Do we need to add docstrings to the pyi files? #2757
Comments
I remember discussing this in previous issues (I'm not able to find any links RN) Anyways, my take was that we can either
Basically, I don't want it to be a manually updated thing that adds developer burden |
There are lots of possibilities here.
|
Hmmm. I think I like the idea of not having separate |
@zoldalma999 Now that the initial PR is merged I'd like to see this continue to move forward. I remember you said you had a branch with a lot of this already done. |
For anyone who wants to help progress with this, here is how to copy portions of docs to the stub files. I'll use
def get_focused() -> bool:
"""True if the display is receiving keyboard input from the system."""
[...]
.. autopgfunction:: get_focused
[...] and your pyi file: [...]
def get_focused() -> bool:
"""True if the display is receiving keyboard input from the system.
Returns ``True`` when the display window has keyboard focus from the
system. If the display needs to ensure it does not lose keyboard focus, it
can use :func:`pygame.event.set_grab()` to grab all input.
"""
[...]
If you are copying over something different (like a method, property or attribute), this should look the same, except for step 6, in which you would not write Here are some of the easy modules to do. Feel free to do more than one function per PR.
|
I feel like I used to see docstrings in my dev environment (VS code), but I don't see them now.
All I see right now is the type information, for example:

If I go into event.pyi as a test and replace the
...
with a docstring, it shows up:If I hover over pygame.event.set_blocked I now see this very insightful information:

This seems like a big win if we can solve this in a nice manner.
The text was updated successfully, but these errors were encountered: