1 configs.field_docs

configs.field_docs

Extract source-owned inline documentation for config and datamodel fields.

The extractor reads Python syntax only. It never imports a model’s runtime target, evaluates annotations, or instantiates configuration objects, which makes it safe for metadata-only configuration inspection.

1.1 Functions

Name Description
field_docstrings Return inline string literals immediately following annotated fields.
inherited_field_docstring Resolve one field docstring from the nearest class in the model MRO.

1.1.1 field_docstrings

configs.field_docs.field_docstrings(model)

Return inline string literals immediately following annotated fields.

1.1.1.1 Parameters

Name Type Description Default
model type Dataclass or Pydantic model class whose source is inspectable. required

1.1.1.2 Returns

Name Type Description
dict[str, str] Field-name to cleaned documentation mapping. Dynamically generated or
dict[str, str] source-unavailable classes return an empty mapping.

1.1.1.3 Notes

Only a literal string expression directly after an AnnAssign is a field docstring. Comments, computed strings, and inherited fields are intentionally excluded; callers may walk the model MRO when needed.

1.1.2 inherited_field_docstring

configs.field_docs.inherited_field_docstring(model, field_name)

Resolve one field docstring from the nearest class in the model MRO.

Back to top