Repository navigation
Frequenz Core Library Release Notes
Summary
This release introduces a better way to deprecate enum members.
Upgrading
Even when this is a minor release, it ships with 2 potential breaking changes for users of DeprecatedAlias and DeprecatedMember:
- The standard warning of a
DeprecatedAliaswithsinceno longer includes the version: it is now<old> is deprecated. Use <new> instead.sinceis only used for the documentation now, following the Frequenz deprecation guide. Update tests matching the old wording. DeprecatedMember.messageis nowstr | None, since a member declared with onlynew_namehas its warning generated when the enum class is created.DeprecatedMemberis not meant to be used directly,deprecated_member()is.
New Features
-
DeprecatedAliasnow acceptssinceandmessagetogether, or neither:sinceis only for the documentation, andmessageonly replaces the warning. This lets an alias with a custom warning still say since which version it is deprecated in its documentation. -
deprecated_member()takes the replacement and version as structured, keyword-only arguments, likeDeprecatedAlias:new_name, the member to use instead in the same enum, andsince, the version it is deprecated since, for the documentation only. Withnew_namethemessagecan be omitted, and the warning is generated with fully qualified names:class TaskStatus(Enum): OPEN = 1 # Warns "mypkg.TaskStatus.PENDING is deprecated. Use mypkg.TaskStatus.OPEN instead." PENDING = deprecated_member(1, new_name="OPEN", since="v1.2.0")
The enum class checks that
new_nameis one of its members and is not deprecated itself. Existing calls passing amessagekeep working unchanged.griffe-frequenz-corewill readsinceandnew_nameto generate the documentation notice of these members.
Bug Fixes
- Docstrings now use absolute cross-references to public paths instead of relative ones. Relative cross-references are expanded from the module where an object is defined since mkdocstrings-python 2.0.9, which broke some links, and projects rendering docstrings inherited from this library needed
relative_crossrefs: truefor them to work at all. See frequenz-repo-config-python#655 for details.
What's Changed
- Clear release notes by @llucax in #205
- Use absolute cross-references in docstrings by @llucax in #207
- Bump the patch group across 1 directory with 4 updates by @dependabot[bot] in #208
- Bump async-solipsism from 0.9 to 0.10 by @dependabot[bot] in #211
- Bump pydoclint from 0.10.0 to 0.11.1 by @dependabot[bot] in #210
- Bump types-markdown from 3.10.2.20260712 to 3.10.2.20261007 by @dependabot[bot] in #212
- Bump isort from 9.0.1 to 9.0.2 by @dependabot[bot] in #213
- Bump the minor group across 1 directory with 6 updates by @dependabot[bot] in #209
- Separate deprecation warnings from documentation notices by @llucax in #214
- Show the hand-written notice in the Enum example by @llucax in #215
Full Changelog: v1.5.0...v1.6.0