Documenting class attributes with type annotations

I do not think you can put an Attribute section inside of your docstring to get your desired results.

I tried giving each attribute a doc comment and specified the type and desired comment.

class DataHolder:
"""
Class to hold some data

Each attribute needs its own doc comment with its type
"""

#: bool: Run without Gui
batch = False

#: bool: Show debug messages
debug = False

#: str: Object Name
name="default"

#: int: Object Version
version = 0

This gives the following output and a nice Type description of each output.

Take a look here:

Please take a look here!

Leave a Comment