Skip to content

Commit 62c3338

Browse files
committed
docs: Generate "Deprecated" admonitions automatically
Wire the `griffe-warnings-deprecated` extension into the mkdocstrings handler options, so every symbol decorated with `typing_extensions.deprecated` gets a "Deprecated" admonition in the API reference with no docstring edit at all. The extension's `kind` is set to `deprecated` rather than the default `warning`, so it emits `class="deprecated"`, which is exactly what a hand-written `Deprecated:` admonition produces. The CSS rule added in the previous commit then styles both, and the two are visually indistinguishable. That matters because the decorator cannot reach everything: module-level aliases, a single function argument, enum members and whole modules still need the admonition written by hand. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
1 parent 3453e28 commit 62c3338

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

‎mkdocs.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ plugins:
101101
python:
102102
paths: ["src"]
103103
options:
104+
extensions:
105+
- griffe_warnings_deprecated:
106+
kind: deprecated
107+
title: Deprecated
104108
docstring_section_style: spacy
105109
inherited_members: true
106110
merge_init_into_class: false

‎pyproject.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ dev-formatting = ["black == 26.5.1", "isort == 9.0.1"]
5757
dev-mkdocs = [
5858
"Markdown == 3.10.3",
5959
"black == 26.5.1",
60+
"griffe-warnings-deprecated == 1.1.1",
6061
"mike == 2.2.0",
6162
"mkdocs-gen-files == 0.6.1",
6263
"mkdocs-literate-nav == 0.6.3",

0 commit comments

Comments
 (0)