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

Document class attributes so they render nicely in our Sphinx docs. #92

Open
JOJ0 opened this issue Apr 2, 2022 · 3 comments
Open

Document class attributes so they render nicely in our Sphinx docs. #92

JOJ0 opened this issue Apr 2, 2022 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@JOJ0
Copy link
Contributor

JOJ0 commented Apr 2, 2022

Some settings in https://github.com/joalla/discogs_client/blob/master/docs/source/conf.py could possibly improved. The autogenerated Python package docs, provided by the Sphinx autodoc extension, somehow copy/inherit one docstring over and over again:

E.g: An attribute that determines its value.... is displayed over and over again:
https://python3-discogs-client.readthedocs.io/en/latest/discogs_client.html#discogs_client.models.CollectionFolder

A possible solution might be to put simple/short docstrings to some of these methods/properties directly and see if it renders in the autodocs and overrides these 'inherited' things.

@JOJ0 JOJ0 added bug Something isn't working documentation Improvements or additions to documentation labels Apr 2, 2022
@JOJ0
Copy link
Contributor Author

JOJ0 commented Aug 23, 2022

The reason for these/this message showing over and over again in several places is that it's taken from the descriptor classes used by a lot of attributes

E.g.
https://github.com/joalla/discogs_client/blob/master/discogs_client/models.py#L38.
and
https://github.com/joalla/discogs_client/blob/master/discogs_client/models.py#L162

To prevent that, simply a short comment+colon can be attached after an attribute code line or if desired a description that renders in the docs could be added after it:

attribute = ObjectField()  #:

or

attribute = ObjectField()  #: Foo description to render in final Sphinx docs...FIXME Syntax allowed here?

@JOJ0
Copy link
Contributor Author

JOJ0 commented Sep 25, 2022

This is the link to the documentation of above described "special comment" for autodoc usage: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#directive-autoattribute

@JOJ0 JOJ0 removed the bug Something isn't working label Sep 25, 2022
@JOJ0 JOJ0 changed the title Fix Sphinx autodoc settings Document class attributes so they render nicely in our Sphinx docs. Sep 25, 2022
@JOJ0
Copy link
Contributor Author

JOJ0 commented Sep 25, 2022

Updated the title of this issue. We should go through all our classes, starting with models.py and at least attach #: to all the class attributes. Most of them are self-explanatory anyway. This would help clean up the cluttered module docs described in my first post in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Development

No branches or pull requests

1 participant