A library to extract attributes docstrings defined in various ways, such as class attributes, NamedTuple fields, or dataclass fields. Current version 0.2.6, released 2025-01-29, maintained infrequently.
pip install class-docVerified import paths — ran on the pinned version, not inferred.
Basic usage: annotate class attributes with a comment after a type annotation, then call attr_doc to extract them.
Ensure each attribute is defined as 'name: type = default # docstring'. The comment must be at the end of the line.
Add type annotations to all attributes you want to extract docstrings from.
Consider alternative libraries like 'docstring_parser' or using 'typing.get_type_hints' with comments manually.