-
Notifications
You must be signed in to change notification settings - Fork 5
Merge tag 'v0.3.3' into v0.x.x #85
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
base: v0.x.x
Are you sure you want to change the base?
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]>
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 tag v0.3.3
into v0.x.x
, introducing a new generic enum_from_proto
utility, deprecating old .from_proto()
methods, and adding microgrid-related ID classes with accompanying tests.
- Added
enum_from_proto
inenum_proto.py
and comprehensive tests intests/test_enum_proto.py
. - Deprecated old
.from_proto()
on metrics and electrical component enums; marked for migration toenum_from_proto
. - Introduced
EnterpriseId
,MicrogridId
,ComponentId
, andSensorId
classes undermicrogrid
, with matching tests intests/microgrid/test_ids.py
.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
tests/test_enum_proto.py | New tests to verify enum_from_proto handling of valid/invalid values |
tests/microgrid/test_ids.py | Tests for string/repr of new ID classes |
src/frequenz/client/common/enum_proto.py | New enum_from_proto implementation |
src/frequenz/client/common/microgrid/init.py | Added EnterpriseId and MicrogridId classes |
src/frequenz/client/common/microgrid/sensors.py | Added SensorId class |
src/frequenz/client/common/microgrid/electrical_components/init.py | Deprecated old .from_proto() , added ComponentId , enriched docs |
src/frequenz/client/common/metric/init.py | Deprecated old Metric.from_proto() , updated imports |
pyproject.toml | Bumped typing-extensions , added frequenz-core , updated warnings rules |
Comments suppressed due to low confidence (2)
tests/microgrid/test_ids.py:10
- The test imports
ComponentId
frommicrogrid.components
, but the class is defined inmicrogrid.electrical_components
. Either moveComponentId
tomicrogrid/components.py
or update the import path tofrequenz.client.common.microgrid.electrical_components
.
from frequenz.client.common.microgrid.components import ComponentId
src/frequenz/client/common/microgrid/electrical_components/init.py:9
- [nitpick] The import of
Enum
is no longer used (classes now derive fromenum.Enum
). Consider removing this unused import to clean up the module.
from enum import Enum
- 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`, `ElectricalComponentId`, and `SensorId`). * tag 'v0.3.3': Update release notes Bump the minimum version of `frequenz-core` to 1.0.2 Deprecate uses of enum's `.from_proto()` Add a generic `enum_from_proto()` function Add the `HVAC` component category Add missing component categories Make enums unique Clear release notes Fix dependencies and prepare release notes for v0.3.2 release Clear release notes Add release notes Add microgrid-related ID types Fix warning filtering in pytest configuration
Question: The ID type prefix for Electrical components before they were explicitly named "electrical" was So I wonder if you think we should bite the bullet and just go with @cwasicki @tiyash-basu-frequenz @shsms (for more context, the prefix is used when converting a ID object to a string, for example when logging an ID) |
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.
Not quite sure how to review this 😅
So it mainly affects logging? Don't have objections against neither of the two options. |
Yeah, it is never easy to review merges, but I would say this: |
Yeah, logging and how people refer to an electrical component ID, as if they don't match it can get pretty confusing. |
Actually now that I think about it, I guess |
frequenz.client.common.enum_proto
has been added, which provides a genericenum_from_proto()
function to convert protobuf enums to Python enums.frequenz.client.common.microgrid.electrical_components.ElectricalComponentCategory
values was improved..from_proto()
are deprecated, please use the newenum_from_proto()
instead.MicrogridId
,EnterpriseId
,ComponentId
, andSensorId
).