Style deprecation notices in the API reference - #306
Merged
Merged
Conversation
Style the `deprecated` admonition class like a warning, but with the `material/grave-stone` icon and its own colour, so deprecation notices read as deprecation notices and not as generic warnings. That class is what a hand-written `Deprecated:` admonition in a docstring produces, and also what the griffe extension added next will emit, so a single rule covers both sources. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
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>
llucax
requested review from
ahmet-erdem-frequenz and
florian-wagner-frequenz
and removed request for
a team
September 21, 2026 12:52
All 35 deprecation notices were written as `Deprecated: Deprecated in v0.18.0`. A custom title replaces the word "Deprecated" in the rendered output, so every one of them came out labelled "Deprecated in v0.18.0", losing the very word the styling added in this branch keys on, and reading differently from the admonitions the griffe extension generates. Drop the title and state the version in the admonition text instead, which is what the deprecations guide asks for. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Contributor
Author
|
Updated: pushed 22ce99e and rewrote the description. The PR originally only added the styling. It turned out the styling alone would not have shown up properly here: all 35 notices were written as The new commit drops the title and states the version in the admonition text instead, per the deprecations guide. All 35 now render with the same label the generated admonitions use.
|
daniel-zullo-frequenz
approved these changes
Sep 22, 2026
Merged
via the queue into
frequenz-floss:v0.x.x
with commit Sep 22, 2026
3505334
12 of 13 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Preparation for the client-common 0.4.1 update, so deprecation notices already look right by the time it adds more of them. This is the repository where the change is immediately visible.
First, the styling: a CSS rule for the
deprecatedadmonition class (gravestone icon, its own colour, otherwise like a warning), and the griffe-warnings-deprecated extension wired into the mkdocstrings handler so symbols decorated withtyping_extensions.deprecatedget an admonition generated for them. The extension'skindis set todeprecatedrather than the defaultwarning, so what it emits is markup-identical to a hand-writtenDeprecated:admonition, and one rule styles both.Then a third commit fixes the admonitions themselves. All 35 were written as
Deprecated: Deprecated in v0.18.0, and a custom title replaces the word "Deprecated" in the rendered output, so every one of them came out labelled "Deprecated in v0.18.0". That loses the word the styling keys on and reads differently from the generated ones. The title is gone and the version is in the text, as the deprecations guide asks.