Skip to content

griffe-sphinx¤

Sponsors only


This extension reads Sphinx-comments above attribute assignments to use them as docstrings.

#: Summary of `module_attr`. 
module_attr = "hello"


class Hello:
    #: Summary of `class_attr`.
    #:
    #: Description of the class attribute.
    #: *Markup* and [cross-references][] are __supported__,
    #: just like in regular docstrings.
    class_attr = "hello"

    def __init__(self):
        #: Summary of `instance_attr`.
        self.instance_attr = "hello"

Comments are treated exactly like regular docstrings: they are "cleaned" (dedented, stripped of leading and trailing new lines) and contain any markup you want, be it Markdown, rST, AsciiDoc, etc.

Trailing comments are not supported:

module_attr  #: This is not supported.