i know i can document (module) constants in sphinx with either
#: a tuple of primes
primes = (2, 3, 5, 7, 11, 13, 17)
or
primes = (2, 3, 5, 7, 11, 13, 17)
"""a tuple of primes"""
which will then appear in the sphinx generated documentation; i.e. it will look something like this:
somemodule.primes
= (2, 3, 5, 7, 11, 13, 17)a tuple of primes
but what if the data is a very long list? then i would like to be able to have a docstring in the documentation but not have the actual data itself in the doc.
this is what i would like to have in the doc:
somemodule.primesa tuple of primes
is there a way i can achieve this?
for completeness:
i ran sphinx-quickstart and enabled autodoc:
autodoc: automatically insert docstrings from modules (y/n) [n]: y
the only thing i have added to index.rst is:
``somemodule``
**************
.. automodule:: somemodule
:members:
and somemodule.py contains this:
#: a tuple of primes
primes = (2, 3, 5, 7, 11, 13, 17)
then i adapted sys.path in conf.py such that somemodule.py is in that path.
sphinx.ext.autodocis enabled; and i use.. automodule::for said module. - hiro protagonistautodatadirective accepts an:annotation:option that lets you hide the constant's value. I don't know ifautomodulerespects that setting if you set it inautodoc_default_options(and if it does, it'll then apply to all constants), but perhaps that's worth a try. - Aran-Feyautodatawith mixed success so far. if i only have an annotation (and no docstring) i seem to get the annotation plus thetupledocstring:tuple() -> empty tuple tuple(iterable) -> tuple initialized from iterable’s items If the argument is a tuple, the return value is the same object.- hiro protagonist