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

Missing Docstrings #225

Open
naveen521kk opened this issue Feb 21, 2021 · 7 comments
Open

Missing Docstrings #225

naveen521kk opened this issue Feb 21, 2021 · 7 comments
Labels

Comments

@naveen521kk
Copy link
Contributor

Using the help function the docstrings should be displayed.

>>> import cairo
>>> help(cairo.Context)
[...]

It doesn't have docs string on the whole. I don't know how exactly to do on a C extension but it is possible(I tried it using Cython it works there). Also, the docs, instead of hardcoding in .rst files, auto-summary sphinx module must be used so that docstrings can be maintained in the source.

@stuaxo
Copy link
Collaborator

stuaxo commented Mar 25, 2021

It looks like PyDoc_STRVAR is the thing to achieve this with.

https://github.com/python/cpython/blob/master/Doc/c-api/intro.rst
https://www.python.org/dev/peps/pep-0007/

smbusmodule uses it here:
https://github.com/pimoroni/py-smbus/blob/master/library/smbusmodule.c

@lazka
Copy link
Member

lazka commented Apr 30, 2021

puh, not sure we want to manage the docs all in C this way... that seems a bit tedious.

@naveen521kk
Copy link
Contributor Author

Or another option would be to write stub python wrappers for the existing C function and classes with docstrings(seems a lot simpler to me). What do you think?

@lazka
Copy link
Member

lazka commented Nov 21, 2022

Is the current type annotation solution good enough to close this?

@lazka lazka added the needinfo label Nov 21, 2022
@stuaxo
Copy link
Collaborator

stuaxo commented Nov 21, 2022

Still looks a bit sparse here -

image

@lazka
Copy link
Member

lazka commented Nov 21, 2022

Nothing changed on the C side of things, so that is expected. Your editor should show the docs though.

@stuaxo
Copy link
Collaborator

stuaxo commented Nov 21, 2022

Looks good -
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants