Skip to content

Commit 0e3bdb8

Browse files
committed
feat: Support new Griffe parsing options warn_missing_types and warnings
Issue-mkdocstrings-437: mkdocstrings/mkdocstrings#437
1 parent e82c24f commit 0e3bdb8

File tree

2 files changed

+64
-1
lines changed

2 files changed

+64
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ classifiers = [
3333
dependencies = [
3434
"mkdocstrings>=0.30",
3535
"mkdocs-autorefs>=1.4",
36-
"griffe>=1.6.2",
36+
"griffe>=1.12.1",
3737
"typing-extensions>=4.0; python_version < '3.11'",
3838
]
3939

src/mkdocstrings_handlers/python/_internal/config.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,24 @@ class GoogleStyleOptions:
186186
),
187187
] = True
188188

189+
warn_missing_types: Annotated[
190+
bool,
191+
_Field(
192+
group="docstrings",
193+
parent="docstring_options",
194+
description="Warn about missing type/annotation for parameters, return values, etc.",
195+
),
196+
] = True
197+
198+
warnings: Annotated[
199+
bool,
200+
_Field(
201+
group="docstrings",
202+
parent="docstring_options",
203+
description="Generally enable/disable warnings when parsing docstrings.",
204+
),
205+
] = True
206+
189207

190208
# YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
191209
@dataclass(**_dataclass_options) # type: ignore[call-overload]
@@ -219,12 +237,57 @@ class NumpyStyleOptions:
219237
),
220238
] = True
221239

240+
warn_missing_types: Annotated[
241+
bool,
242+
_Field(
243+
group="docstrings",
244+
parent="docstring_options",
245+
description="Warn about missing type/annotation for parameters, return values, etc.",
246+
),
247+
] = True
248+
249+
warnings: Annotated[
250+
bool,
251+
_Field(
252+
group="docstrings",
253+
parent="docstring_options",
254+
description="Generally enable/disable warnings when parsing docstrings.",
255+
),
256+
] = True
257+
222258

223259
# YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
224260
@dataclass(**_dataclass_options) # type: ignore[call-overload]
225261
class SphinxStyleOptions:
226262
"""Sphinx style docstring options."""
227263

264+
warn_unknown_params: Annotated[
265+
bool,
266+
_Field(
267+
group="docstrings",
268+
parent="docstring_options",
269+
description="Warn about documented parameters not appearing in the signature.",
270+
),
271+
] = True
272+
273+
warn_missing_types: Annotated[
274+
bool,
275+
_Field(
276+
group="docstrings",
277+
parent="docstring_options",
278+
description="Warn about missing type/annotation for return values.",
279+
),
280+
] = True
281+
282+
warnings: Annotated[
283+
bool,
284+
_Field(
285+
group="docstrings",
286+
parent="docstring_options",
287+
description="Generally enable/disable warnings when parsing docstrings.",
288+
),
289+
] = True
290+
228291

229292
# YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
230293
@dataclass(**_dataclass_options) # type: ignore[call-overload]

0 commit comments

Comments
 (0)