I want to document a constant by its docstring. I don't want to let the value to show up. If I have a long list, Sphinx will include it completely which I don't want. It would be okay for me if only an excerpt would be shown (with ellipsis or whatever). But not thousands of list elements.
module_level_variable2 = 98765
"""int: Module level variable documented inline.
The docstring may span multiple lines. The type may optionally be specified
on the first line, separated by a colon.
"""
I've tried the following:
.. autoclass:: module_level_variable2
does not show the docstring at all.
.. autodata:: module_level_variable2
does show docstring and the data.
.. automethod:: module_level_variable2
and .. autoattribute:: module_level_variable2
do not show anything in the documentation (not even the name of the variable).
.. autofunction:: module_level_variable2
does show the docstring only. This is almost what I want. However, it considers a constant as a function() by adding parentheses to it - which is wrong (why a warning is raised on make html
!
I went through http://www.sphinx-doc.org/en/1.4.8/ext/autodoc.html but could not find a switch to tell .. autodata::
not to show the data itself (but the docstring only).
SOLUTION
.. autodata:: module_level_variable2
:annotation: