Skip to content

Add the deprecations tooling - #585

Merged
llucax merged 5 commits into
frequenz-floss:v1.x.xfrom
llucax:deprecations-tooling
Nov 5, 2026
Merged

llucax merged 5 commits into
frequenz-floss:v1.x.xfrom
llucax:deprecations-tooling

Conversation

@llucax

@llucax llucax commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Add the tooling the deprecations guide needs, before deprecating anything for v2.0.0 (#365).

  • Add frequenz-core >= 1.6.0, < 2 as a runtime dependency, and raise the typing-extensions floor to >= 4.13.0, which core 1.6.0 requires.
  • Replace the pytest warning options with the guide's filterwarnings, including the entry that makes this project's own deprecations an error. The existing deprecation messages don't match it, so the tests still pass.
  • Add the deprecated admonition style to docs/_css/mkdocstrings.css, copied from Document deprecations with a Deprecated: admonition frequenz-repo-config-python#641 (merged, not released yet).
  • Stop BroadcastChannel() from emitting Broadcast's deprecation warning, with a test.

The griffe-frequenz-core extension is not enabled: the release that reads frequenz-core 1.6's arguments is not out yet (v1.0.0 is the latest), so the Deprecated: notices will be written by hand for now.

Fixes #576

@github-actions github-actions Bot added part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:tooling Affects the development tooling (CI, deployment, dependency management, etc.) part:channels Affects channels implementation labels Nov 5, 2026
The deprecations guide builds on `frequenz.core.warnings`, which
provides `deprecated_aliases()` to keep old import paths working and
`ignoring_deprecations()` to use deprecated symbols internally without
warning users twice.

The lower bound is 1.6.0 because that release makes the warnings follow
the guide: `since` is only used for the documentation and no longer
appears in the warning, and it can be combined with a custom `message`.
Starting from that version also avoids having to rewrite the tests that
match the warnings later. The upper bound excludes the next major
version, as usual.

`frequenz-core` 1.6.0 requires `typing-extensions >= 4.13.0`, so raise
that floor too; otherwise the minimum dependencies can't be installed
together (`nox -s pytest_min` fails to resolve them).

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Replace the warning flags in `addopts` with the `filterwarnings` the
deprecations guide recommends: every warning is an error, except that
deprecations coming from dependencies are only reported once, so they
don't fail the test suite.

Add the guide's last entry too, which makes using a symbol this project
deprecated itself an error. This way the project never releases code
that still uses its own deprecated symbols, which users would get as
warnings they can do nothing about. It only matches messages starting
with `frequenz.channels.<symbol> is deprecated`, so it doesn't affect
the existing deprecations (`Broadcast`, `Anycast`, `OptionalReceiver`
and the `close()` methods), whose messages don't follow that pattern;
the new ones will.

The entry goes after the `once::` ones because later filters take
precedence.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
The deprecations guide documents every deprecation with a `Deprecated:`
admonition, but Material for MkDocs only styles a fixed set of kinds, so
it would render without a title style or icon.

Add the CSS for the `deprecated` kind, copied from the repository
configuration template (frequenz-repo-config-python#641, merged but not
released yet), so this file stays identical to the one the next release
generates and the migration doesn't change it.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
`BroadcastChannel` is built on top of `Broadcast`, so every call to
`BroadcastChannel()` emitted `Broadcast`'s deprecation warning. Users
can't do anything about it, as they aren't using `Broadcast` at all, and
it hid the warnings that matter.

Wrap only the internal `Broadcast` creation in `ignoring_deprecations()`
instead of using `warnings.catch_warnings()`, which resets the
deduplication history of the whole program, as the deprecations guide
recommends.

This is enough for v1.x.x; v2.x.x will fix it differently.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Mention the new `frequenz-core` dependency, which is visible to users
when they upgrade, and that `BroadcastChannel()` no longer emits the
`Broadcast` deprecation warning.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
@llucax
llucax force-pushed the deprecations-tooling branch from 1e2bb5d to 2e34599 Compare November 5, 2026 12:42
@llucax
llucax marked this pull request as ready for review November 5, 2026 12:44
@llucax
llucax requested a review from a team as a code owner November 5, 2026 12:44
@llucax
llucax requested review from a team, daniel-zullo-frequenz and shsms and removed request for a team November 5, 2026 12:44
@llucax
llucax enabled auto-merge November 5, 2026 12:45
@llucax
llucax added this pull request to the merge queue Nov 5, 2026
Merged via the queue into frequenz-floss:v1.x.x with commit bb66728 Nov 5, 2026
9 checks passed
@llucax
llucax deleted the deprecations-tooling branch November 5, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:channels Affects channels implementation part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:tooling Affects the development tooling (CI, deployment, dependency management, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add frequenz-core and the deprecations tooling

2 participants