Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 11 additions & 35 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,16 @@

## Summary

<!-- Here goes a general summary of what this release is about -->

## Upgrading

<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->

## New Features

* `frequenz.core.enum` now provides a `@unique` decorator that is aware of deprecations, and will only check for uniqueness among non-deprecated enum members.

For example this works:

```py
>>> from frequenz.core.enum import DeprecatedMember, Enum, unique
>>>
>>> @unique
... class Status(Enum):
... ACTIVE = 1
... INACTIVE = 2
... PENDING = DeprecatedMember(1, "PENDING is deprecated, use ACTIVE instead")
...
>>>
```

While using the standard library's `enum.unique` decorator raises a `ValueError`:

```py
>>> from enum import unique
>>> from frequenz.core.enum import DeprecatedMember, Enum
>>>
>>> @unique
... class Status(Enum):
... ACTIVE = 1
... INACTIVE = 2
... PENDING = DeprecatedMember(1, "PENDING is deprecated, use ACTIVE instead")
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.12/enum.py", line 1617, in unique
raise ValueError('duplicate values found in %r: %s' %
ValueError: duplicate values found in <enum 'Status'>: PENDING -> ACTIVE
>>>
```
<!-- Here goes the main new features and examples or instructions on how to use them -->

## Bug Fixes

<!-- Here goes notable bug fixes that are worth a special mention or explanation -->