Skip to content

Document that deprecated_aliases() needs __all__ - #221

Merged
llucax merged 1 commit into
frequenz-floss:v1.x.xfrom
llucax:deprecated-aliases-all
Nov 6, 2026
Merged

llucax merged 1 commit into
frequenz-floss:v1.x.xfrom
llucax:deprecated-aliases-all

Conversation

@llucax

@llucax llucax commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

A star import only asks a module's __getattr__ for names in __all__, so without one, aliases made with deprecated_aliases() vanish from from module import * and fail later with a NameError instead of warning. This came up in a review of frequenz-floss/frequenz-channels-python#590.

This adds a warning about it to the deprecated_aliases() docstring, and __all__ to its usage example and the README example. Docs only, so no release notes.

A star import only asks the module `__getattr__` for names listed in
`__all__`, so in a module without one the aliases silently disappear
from `from module import *`, and code using them fails with a
`NameError` instead of getting the deprecation warning.

Warn about it in the docstring, and add `__all__` to the usage example
and the README example so copying them does the right thing.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
@llucax
llucax requested a review from a team as a code owner November 5, 2026 15:20
@llucax
llucax requested review from daniel-zullo-frequenz and removed request for a team November 5, 2026 15:20
@llucax llucax added the cmd:skip-release-notes It is not necessary to update release notes for this PR label Nov 5, 2026
@github-actions github-actions Bot added part:docs Affects the documentation part:warnings Affects the `warnings` module labels Nov 5, 2026
@llucax
llucax requested a review from Marenz November 6, 2026 10:55
@llucax llucax added this to the v1.7.0 milestone Nov 6, 2026
@llucax
llucax enabled auto-merge November 6, 2026 10:55
@llucax
llucax added this pull request to the merge queue Nov 6, 2026
Merged via the queue into frequenz-floss:v1.x.x with commit 36c6470 Nov 6, 2026
12 of 13 checks passed
@llucax
llucax deleted the deprecated-aliases-all branch November 6, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cmd:skip-release-notes It is not necessary to update release notes for this PR part:docs Affects the documentation part:warnings Affects the `warnings` module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants