Skip to content

Conversation

@llucax
Copy link
Contributor

@llucax llucax commented Aug 26, 2025

This commit introduces a new frequenz.core.enum module that provides a drop-in replacement for the standard library's enum.Enum class, with added support for deprecating enum members.

@Copilot Copilot AI review requested due to automatic review settings August 26, 2025 10:09
@llucax llucax requested a review from a team as a code owner August 26, 2025 10:09
@llucax llucax self-assigned this Aug 26, 2025
@github-actions github-actions bot added part:docs Affects the documentation part:datetime Affects the datetime module labels Aug 26, 2025
Copilot

This comment was marked as outdated.

Signed-off-by: Leandro Lucarella <[email protected]>
@llucax llucax added this to the v1.1.0 milestone Aug 26, 2025
@github-actions github-actions bot added part:tests Affects the unit, integration and performance (benchmarks) tests part:tooling Affects the development tooling (CI, deployment, dependency management, etc.) labels Aug 26, 2025
@llucax llucax requested review from Marenz and Copilot August 26, 2025 10:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new frequenz.core.enum module that provides an enhanced Enum class supporting deprecated enum members. The implementation extends the standard library's enum functionality to emit deprecation warnings when deprecated members are accessed.

Key changes:

  • Added DeprecatedMember class for marking deprecated enum members
  • Implemented DeprecatingEnumMeta metaclass to handle deprecation logic
  • Created comprehensive test suite covering attribute access, name lookup, and value lookup scenarios

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/frequenz/core/enum.py Main implementation of the enhanced Enum class with deprecation support
tests/test_enum.py Comprehensive test suite covering all deprecation warning scenarios
src/frequenz/core/datetime.py Minor docstring update to improve module description
RELEASE_NOTES.md Documentation of the new enum module feature
README.md Added usage example for the new enum functionality
.github/labeler.yml Added part:enum label configuration
.github/keylabeler.yml Added enum part to key label mappings
.github/ISSUE_TEMPLATE/bug.yml Added enum utilities to bug template options

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@llucax llucax added the type:enhancement New feature or enhancement visitble to users label Aug 26, 2025
@llucax llucax enabled auto-merge August 26, 2025 10:20
llucax and others added 2 commits August 26, 2025 12:21
Signed-off-by: Leandro Lucarella <[email protected]>
Co-authored-by: Copilot <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
Marenz
Marenz previously approved these changes Aug 26, 2025
Copy link
Contributor

@Marenz Marenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@llucax
Copy link
Contributor Author

llucax commented Aug 26, 2025

I added a new fixup commit to replace EnumMeta with EnumType as this is the new name as of Python 3.11.

This commit introduces a new `frequenz.core.enum` module that provides
a drop-in replacement for the standard library's `enum.Enum` class, with
added support for deprecating enum members.

Signed-off-by: Leandro Lucarella <[email protected]>
llucax added 2 commits August 26, 2025 13:36
Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
@llucax
Copy link
Contributor Author

llucax commented Aug 26, 2025

And now that I see it was approved, I squashed all fixup commits, so this is ready for a final approval.

@llucax llucax added this pull request to the merge queue Aug 26, 2025
Merged via the queue into frequenz-floss:v1.x.x with commit 8fbba31 Aug 26, 2025
5 checks passed
@llucax llucax deleted the enum branch August 26, 2025 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:datetime Affects the datetime module 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.) type:enhancement New feature or enhancement visitble to users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants