Skip to content

Upgrade to microgrid client v0.7 #1182

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

Open
wants to merge 3 commits into
base: v1.x.x
Choose a base branch
from

Conversation

llucax
Copy link
Contributor

@llucax llucax commented Mar 24, 2025

Use the new microgrid client ComponentId and MicrogridId.

@Copilot Copilot AI review requested due to automatic review settings March 24, 2025 08:28
@llucax llucax requested a review from a team as a code owner March 24, 2025 08:28
@llucax llucax requested review from ela-kotulska-frequenz and removed request for a team March 24, 2025 08:28
@llucax llucax marked this pull request as draft March 24, 2025 08:28
@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:data-pipeline Affects the data pipeline part:microgrid Affects the interactions with the microgrid labels Mar 24, 2025
@llucax
Copy link
Contributor Author

llucax commented Mar 24, 2025

Draft to avoid merging accidentally because it depends on frequenz-floss/frequenz-client-microgrid-python#122 and a release, but it is really ready for a review.

Copy link

@Copilot 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 upgrades the project to use microgrid client v0.7 by replacing many usages of raw integer component IDs with the new ComponentId type and updating dependency/version references. Key changes include:

  • Updating dependency constraints in pyproject.toml and documentation in RELEASE_NOTES.md and mkdocs.yml.
  • Replacing int‑based component IDs with ComponentId in multiple modules throughout the SDK.
  • Adjusting type annotations, function signatures, and caches accordingly to support the new microgrid client types.

Reviewed Changes

Copilot reviewed 67 out of 67 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pyproject.toml Updated dependency for frequenz-client-microgrid to use a git reference for v0.7.
RELEASE_NOTES.md Documented upgrade to v0.7 and changes in how IDs are handled.
mkdocs.yml Commented out the previous version’s documentation objects inventory for microgrid client.
Multiple SDK modules Converted int types to ComponentId in function signatures, caches, documentation, and type hints.
benchmarks/power_distribution/power_distributor.py Updated benchmark function signatures to use ComponentId instead of int.
Comments suppressed due to low confidence (3)

pyproject.toml:32

  • Consider replacing the temporary git dependency with the official v0.7 release reference once it is published to ensure reproducible builds.
#  "frequenz-client-microgrid >= 0.7.0, < 0.8.0",

src/frequenz/sdk/microgrid/_power_distributing/_component_managers/_battery_manager.py:188

  • [nitpick] Since the method now returns ComponentId instead of int, please verify that all dependent modules and downstream usages are updated accordingly.
def component_ids(self) -> collections.abc.Set[ComponentId]:

benchmarks/power_distribution/power_distributor.py:40

  • [nitpick] Updating the batteries type from int to ComponentId may affect benchmark logic; please ensure these changes are validated across all benchmark tests.
async def send_requests(batteries: set[ComponentId], request_num: int) -> list[Result]:

@llucax llucax force-pushed the microgrid-client-0.7 branch from 788dd7f to 9c959c2 Compare March 24, 2025 08:30
@llucax llucax moved this from To do to Review in progress in Python SDK Roadmap Mar 24, 2025
@llucax llucax added this to the v1.0.0-rc1800 milestone Mar 24, 2025
@llucax llucax force-pushed the microgrid-client-0.7 branch from 9c959c2 to 443237b Compare March 24, 2025 14:05
@llucax llucax marked this pull request as ready for review March 24, 2025 14:06
@llucax llucax requested a review from shsms March 24, 2025 14:06
@llucax
Copy link
Contributor Author

llucax commented Mar 24, 2025

Ready for review now.

@llucax llucax enabled auto-merge March 24, 2025 14:06
Copy link
Contributor

@shsms shsms left a comment

Choose a reason for hiding this comment

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

You could make a few more commits; it's fine if they don't pass the tests individually. Or at least make fixup commits for review and squash before merging. Otherwise, it is too hard to keep track of where you are if you have to take several breaks while reviewing.

@llucax llucax added this pull request to the merge queue Mar 24, 2025
@github-project-automation github-project-automation bot moved this from Review in progress to Review approved in Python SDK Roadmap Mar 24, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 24, 2025
@llucax
Copy link
Contributor Author

llucax commented Mar 26, 2025

I can only see breaking the commit on a per-file basis, but that doesn't really bring much, if you want to resume the review after a while and splitting on a file-by-file basis is enough, then you can just use GitHub feature of marking files as read in the review.

image

If you think there was another way to split the commit, I'm interested!

@llucax llucax added this pull request to the merge queue Mar 26, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 26, 2025
@shsms
Copy link
Contributor

shsms commented Mar 26, 2025

I can only see breaking the commit on a per-file basis, but that doesn't really bring much, if you want to resume the review after a while and splitting on a file-by-file basis is enough, then you can just use GitHub feature of marking files as read in the review.

I see, didn't know that. I'll try.

@shsms
Copy link
Contributor

shsms commented Mar 26, 2025

Now an amd test is also failing :-|

@llucax
Copy link
Contributor Author

llucax commented Mar 26, 2025

Oh dear, failing in Python 3.12 which I'm not using to test locally. Is the component graph tests, so I wonder if it is the set[int] ordering coming to bite us in a different way in 3.12 (maybe I missed some fix that worked in 3.11). I will need to have a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part:data-pipeline Affects the data pipeline part:docs Affects the documentation part:microgrid Affects the interactions with the microgrid part:tests Affects the unit, integration and performance (benchmarks) tests part:tooling Affects the development tooling (CI, deployment, dependency management, etc.)
Projects
Status: Review approved
Development

Successfully merging this pull request may close these issues.

2 participants