-
Notifications
You must be signed in to change notification settings - Fork 5
Merge v0.3.x into v0.x.x #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Leandro Lucarella <[email protected]>
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]>
Signed-off-by: Leandro Lucarella <[email protected]>
There was a problem hiding this 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 v0.3.x branch changes into v0.x.x, introducing several new utilities and components for microgrid client functionality. The changes focus on adding ID classes, enum conversion utilities, and expanding component categories.
- Adds new ID classes for enterprises, microgrids, components, and sensors with standardized string prefixes
- Introduces a new
enum_from_protoutility function for converting protobuf enum values to Python enums with better error handling - Expands microgrid component categories with new types like converters, crypto miners, electrolyzers, and HVAC systems
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/frequenz/client/common/enum_proto.py |
New utility module for protobuf enum conversion with type safety and error handling |
src/frequenz/client/common/microgrid/__init__.py |
Adds EnterpriseId and MicrogridId classes with "EID" and "MID" prefixes |
src/frequenz/client/common/microgrid/sensors.py |
New SensorId class with "SID" prefix for sensor identification |
src/frequenz/client/common/microgrid/components/__init__.py |
Adds ComponentId class and new component categories, deprecates old enum methods |
src/frequenz/client/common/metric/__init__.py |
Updates enum imports and deprecates old from_proto method |
tests/test_enum_proto.py |
Comprehensive tests for the new enum_from_proto utility |
tests/microgrid/test_ids.py |
Tests for string representation of new ID classes |
pyproject.toml |
Updates dependencies and test configuration |
RELEASE_NOTES.md |
Removes outdated upgrade notes |
| UNSPECIFIED = 0 | ||
| SOME_VALUE = 1 | ||
| enum_value = enum_from_proto(proto_pb2.SomeEnum.SOME_ENUM_SOME_VALUE, SomeEnum) |
Copilot
AI
Aug 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example imports proto_pb2 with a pylint disable comment, but this import will fail in practice. Consider using a more realistic example or clarifying that this is pseudocode.
This merges all v0.3.x changes into the v0.x.x branch.
I assume we had an extra v0.3.x branch due to the rename changes of Components -> ElectricalComponents.
Since then we decided to handle those API updates using extra paths like
.v1alpha8, so we can add back the changes of v0.3.x and stay API compatible with our dependees.frequenz.client.common.enum_protohas been added, which provides a genericenum_from_proto()function to convert protobuf enums to Python enums.frequenz.client.common.microgrid.electrical_components.ElectricalComponentCategoryvalues was improved..from_proto()are deprecated, please use the newenum_from_proto()instead.MicrogridId,EnterpriseId,ComponentId, andSensorId).