How can I properly document a constant, say foo = 4
in Python(3) Code with Sphinx in such a way, that I can access them with something like :attr:`foo`?
My current solution would be creating a class and moving the constants into properties:
class Constants:
@property
def foo(self):
"""Cool Documentation."""
return 4
Then add in the classes.rst file:
..autoclass:: Constants
:members:
However this should not be the right way to do it,
as it forces me to carry around an instance of Constants
in my Code.
In case it matters: I'm using Numpy style