Skip to content

Commit 9a899dc

Browse files
committed
Clarify how to document instance attributes
1 parent 4082e2f commit 9a899dc

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/doc_conventions.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,20 @@ and
140140
See :ref:`custom title<features/argument_processing:Help Messages>`
141141

142142

143+
API Documentation
144+
-----------------
145+
146+
The API documentation is mostly pulled from docstrings in the source code using
147+
the Sphinx `autodoc
148+
<https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html>`_
149+
extension. However, Sphinx has issues generating documentation for instance
150+
attributes (see `cmd2 issue 821
151+
<https://github.com/python-cmd2/cmd2/issues/821>`_ for the full discussion). We
152+
have chosen to not use code as the source of instance attribute documentation.
153+
Instead, it is added manually to the documentation files in ``cmd2/docs/api``.
154+
See ``cmd2/docs/api/cmd.rst`` to see how to add documentation for an attribute.
155+
156+
143157
Links to API Reference
144158
----------------------
145159

0 commit comments

Comments
 (0)