-
Notifications
You must be signed in to change notification settings - Fork 5
feat: Update frequenz-api-common to v0.8 and adapt to API changes #96
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
feat: Update frequenz-api-common to v0.8 and adapt to API changes #96
Conversation
58381b3 to
38cb5fe
Compare
This reverts commit 495d2c6. Signed-off-by: Mathias L. Baumann <[email protected]>
38cb5fe to
396275c
Compare
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 updates the frequenz-api-common dependency to v0.8.0 and adapts the codebase to support the new v1alpha8 API version while maintaining backward compatibility with the existing API.
- Updates dependency from a git reference to a proper version constraint (v0.8.0)
- Introduces a new v1alpha8 module structure with updated components, pagination, and metric definitions
- Refactors the existing components module to use the v1 API and simplified naming conventions
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Updates frequenz-api-common dependency to v0.8.0 |
| src/frequenz/client/common/v1alpha8/ | Adds new v1alpha8 module with electrical components, pagination, and metrics |
| src/frequenz/client/common/microgrid/components/ | Creates new components module with simplified naming (ComponentCategory vs ElectricalComponentCategory) |
| tests/test_client_common_v1alpha8.py | Adds tests for the new v1alpha8 electrical components |
| tests/test_client_common.py | Updates existing tests to use the new simplified component naming |
| RELEASE_NOTES.md | Documents the addition of v1alpha8 module support |
|
|
||
| RELAY = PBElectricalComponentCategory.ELECTRICAL_COMPONENT_CATEGORY_RELAY | ||
| BREAKER = PBElectricalComponentCategory.ELECTRICAL_COMPONENT_CATEGORY_BREAKER | ||
| """A relay, used for switching electrical circuits on and off.""" |
Copilot
AI
Aug 7, 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 documentation comment describes this as 'A relay' but the enum value is BREAKER. The documentation should be updated to reflect that this is a breaker component.
| """A relay, used for switching electrical circuits on and off.""" | |
| """A breaker, used for switching and protecting electrical circuits.""" |
|
|
||
|
|
||
| @dataclass(frozen=True, kw_only=True) | ||
| class Params: |
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.
better keep the original name, no? This could lead to ambiguous code otherwise.
| class Params: | |
| class PaginationParams: |
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.
I copied it from v1 (non-versioned in this repo) like that. But true, we can use this opportunity to rename it in alpha8
Introduces a new module `v1alpha8` that provides all the updates/changes that the common-api introduces. Signed-off-by: Mathias L. Baumann <[email protected]>
396275c to
76dda73
Compare
|
I'm not convinced we should just create a new namespace here as we do with protobuf. Unlike protobuf messages, which are wire-compatible, adding more classes to python could be problematic (mainly because we use type hints, if we didn't then things would work like with protobuf). If someone imports from one namespace and then try to pass the instance to a function that expects an instance from a different namespace, then things will break. In particular classes inheriting from We need to give more thought to this. |
This PR introduces a new module v1alpha8 that provides all the updates/changes that the common-api introduces. It also reverts the renaming of Components to ElectricalComponents to stay backwards compatible (the rename was not yet released)