joalla/discogs_client

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

JOJ0 opened this issue · 3 comments

JOJ0 commented

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 commented

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 commented

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 commented

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.