Skip to content

Commit 6fee875

Browse files
committed
docs(conf): Suppress forward reference warnings from sphinx-autodoc-typehints
why: Types in TYPE_CHECKING blocks (used for circular import avoidance) cause sphinx-autodoc-typehints to emit warnings about unresolvable forward references. These warnings are expected and safe to suppress. what: - Add suppress_warnings config for sphinx_autodoc_typehints.forward_reference
1 parent 4527b7f commit 6fee875

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

docs/conf.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,15 @@
118118
"member-order": "bysource",
119119
}
120120

121+
# Automatically extract typehints when specified and place them in
122+
# descriptions of the relevant function/method.
123+
autodoc_typehints = "description"
124+
# Don't show class signature with the class' name.
125+
autodoc_class_signature = "separated"
126+
121127
# sphinx-autodoc-typehints
122-
autodoc_typehints = "signature"
123-
# When autodoc_typehints = "signature", disable parameter type injection
124-
# to prevent RST indentation conflicts with Napoleon-processed docstrings
125-
always_document_param_types = False
126-
# Disable return type injection in docstrings (types shown in signature only)
127-
typehints_document_rtype = False
128-
# Suppress cosmetic warnings for forward references in TYPE_CHECKING blocks
128+
# Suppress warnings for forward references that can't be resolved
129+
# (types in TYPE_CHECKING blocks used for circular import avoidance)
129130
suppress_warnings = [
130131
"sphinx_autodoc_typehints.forward_reference",
131132
]

0 commit comments

Comments
 (0)