Constances in autodoc

24 views
Skip to first unread message

Louis King

unread,
Jun 26, 2021, 7:05:33 PMJun 26
to sphinx-users

All, I realize in python, a constant is really just a state of mind but I would like to document them.
When I give a constant an all caps name i.e. VERBOSE in a module or class sphinx/autodoc does identify them with bold text name, following the docstring.
VERBOSE = True
I would like to add documentation, what it is and how it us used as with variables or  arguments.

Currently I am using :cvar ... to document constants, but that is less than ideal.
Am I missing something? Others have a better idea?

Komiya Takeshi

unread,
Jun 27, 2021, 9:55:15 AMJun 27
to sphinx...@googlegroups.com
Hi,

How about using `#:` style comment for the constant?
https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#directive-automethod

Thanks,
Takeshi KOMIYA

2021年6月27日(日) 8:05 Louis King <ag20...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/d3745971-c225-4e94-a853-acfe94b4a11fn%40googlegroups.com.

Louis King

unread,
Jun 27, 2021, 7:04:18 PMJun 27
to sphinx-users

Takeshi KOMIYA thanks for the pointer. just what I was looking for. thnaks.
Reply all
Reply to author
Forward
0 new messages