Skip to content

Conversation

@llucax
Copy link
Contributor

@llucax llucax commented Jul 1, 2025

Merge tag 'v0.3.3' into v0.x.x

  • A new module frequenz.client.common.enum_proto has been added, which provides a generic enum_from_proto() function to convert protobuf enums to Python enums.
  • Documentation for some frequenz.client.common.microgrid.electrical_components.ElectricalComponentCategory values was improved.
  • The metrics and components enums .from_proto() are deprecated, please use the new enum_from_proto() instead.
  • Classes to represent microgrid-related ID were added (MicrogridId, EnterpriseId, ComponentId, and SensorId).

llucax and others added 18 commits June 6, 2025 12:42
Adds: EnterpriseId, MicrogridId, ComponentId and SensorId.

Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
We need to bump typing-extensions to 4.13.0 because that's the minimum
supported version declaraed by `frequenz-core`.

Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
This needs a bump of the minimum `frequenz-api-common` to v0.6.1 as this
category was added in that version.

Signed-off-by: Leandro Lucarella <[email protected]>
This function can convert any `int` to any `Enum`, with optional
validation or forward-compatibility.

Signed-off-by: Leandro Lucarella <[email protected]>
Recommend using the new `enum_from_proto()` instead.

Signed-off-by: Leandro Lucarella <[email protected]>
This is to avoid errors in tests about duplicated `BaseId` prefixes.

Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
@llucax llucax self-assigned this Jul 1, 2025
Copilot AI review requested due to automatic review settings July 1, 2025 09:07
@llucax llucax requested a review from a team as a code owner July 1, 2025 09:07
@llucax llucax added the type:enhancement New feature or enhancement visitble to users label Jul 1, 2025
@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:microgrid Affects the microgrid protobuf definitions labels Jul 1, 2025
Copy link

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 merges tag v0.3.3 into v0.x.x, introducing a generic enum conversion helper, deprecating specialized .from_proto() methods, and adding microgrid ID types.

  • Introduce enum_from_proto utility with comprehensive tests.
  • Deprecate existing .from_proto() on metrics and component enums.
  • Add EnterpriseId, MicrogridId, ComponentId, and SensorId (with matching tests).

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_enum_proto.py Add tests for enum_from_proto, covering valid/invalid cases.
src/frequenz/client/common/enum_proto.py Implement enum_from_proto with overloads and doc examples.
src/frequenz/client/common/microgrid/init.py Add EnterpriseId and MicrogridId ID classes.
src/frequenz/client/common/microgrid/components/init.py Add ComponentId, update imports, deprecate old enum helpers.
src/frequenz/client/common/microgrid/sensors.py Add SensorId ID class.
src/frequenz/client/common/metric/init.py Deprecate old Metric.from_proto().
tests/microgrid/test_ids.py Add tests for string and repr of all new ID classes.
pyproject.toml Bump dependencies, simplify pytest warning settings.
RELEASE_NOTES.md Document new module, deprecations, and dependency bumps.
Comments suppressed due to low confidence (1)

RELEASE_NOTES.md:10

  • The release notes mention bumped dependencies but no longer refer to the required bump for typing-extensions (now >=4.13.0); please update or re-add that entry to keep notes in sync with pyproject.toml.
- Some minimum dependencies have been bumped, you might need to update your minimum dependencies too:

addopts = "-W=all -Werror -Wdefault::DeprecationWarning -Wdefault::PendingDeprecationWarning '-Wdefault:Protobuf gencode version 5.27.2 is exactly one major version older than the runtime version:UserWarning' -vv"
addopts = "-vv"
filterwarnings = [
"error",
Copy link

Copilot AI Jul 1, 2025

Choose a reason for hiding this comment

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

The simple "error" filter may not match any specific warning category; consider using explicit filters (e.g., "error::Warning") or re-enable -Werror to ensure all warnings are treated as errors as intended.

Suggested change
"error",
"error::Warning",

Copilot uses AI. Check for mistakes.
@llucax llucax closed this Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:docs Affects the documentation part:microgrid Affects the microgrid protobuf definitions 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