Skip to content

Commit 4893357

Browse files
authored
Bump the frequenz-client-microgrid dependency to 0.5.0 (#1057)
2 parents 469554a + c359b2c commit 4893357

File tree

8 files changed

+19
-22
lines changed

8 files changed

+19
-22
lines changed

RELEASE_NOTES.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
## Summary
44

5-
<!-- Here goes a general summary of what this release is about -->
5+
This release mainly introduces a new feature that allows fallback components to be used in generated formulas, but it also fixes a few bugs and gets rid of `betterproto`/`grpclib` and goes back to Google's implementation.
66

77
## Upgrading
88

9-
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
9+
- The `frequenz-client-microgrid` dependency was bumped to `0.5.0`. This can cause dependency issues if you are using other API clients and the `frequenz-client-base` dependencies don't match.
1010

1111
## New Features
1212

@@ -19,8 +19,6 @@
1919

2020
## Bug Fixes
2121

22-
- Bump the `grpclib` dependency to pull a fix for using IPv6 addresses.
23-
2422
- Allow setting `api_power_request_timeout` in `microgrid.initialize()`.
2523

2624
- Fix an issue where in grid meters could be identified as {pv/ev/battery/chp} meters in some component graph configurations.

mkdocs.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ plugins:
115115
import:
116116
# See https://mkdocstrings.github.io/python/usage/#import for details
117117
- https://docs.python.org/3/objects.inv
118-
- https://frequenz-floss.github.io/frequenz-channels-python/v0.16/objects.inv
119-
- https://frequenz-floss.github.io/frequenz-client-microgrid-python/v0.4/objects.inv
118+
- https://frequenz-floss.github.io/frequenz-channels-python/v1.1/objects.inv
119+
- https://frequenz-floss.github.io/frequenz-client-microgrid-python/v0.5/objects.inv
120120
- https://networkx.org/documentation/stable/objects.inv
121121
- https://numpy.org/doc/stable/objects.inv
122122
- https://typing-extensions.readthedocs.io/en/stable/objects.inv

pyproject.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@ dependencies = [
2929
# Make sure to update the mkdocs.yml file when
3030
# changing the version
3131
# (plugins.mkdocstrings.handlers.python.import)
32-
"frequenz-client-microgrid >= 0.4.0, < 0.5.0",
32+
"frequenz-client-microgrid >= 0.5.0, < 0.6.0",
3333
"frequenz-channels >= 1.1.0, < 2.0.0",
3434
"networkx >= 2.8, < 4",
3535
"numpy >= 1.26.4, < 2",
3636
"typing_extensions >= 4.6.1, < 5",
37-
"grpclib >= 0.4.8rc2",
3837
]
3938
dynamic = ["version"]
4039

src/frequenz/sdk/actor/__init__.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ async def main() -> None: # (2)!
454454
455455
This example shows how to create an actor that receives messages from multiple
456456
[broadcast][frequenz.channels.Broadcast] channels using
457-
[`select()`][frequenz.channels.util.select].
457+
[`select()`][frequenz.channels.select].
458458
459459
```python title="select.py"
460460
import asyncio
@@ -530,7 +530,7 @@ async def main() -> None: # (6)!
530530
them to another channel.
531531
532532
2. We implement the [`_run()`][_run] method that will receive messages from the two
533-
channels using [`select()`][frequenz.channels.util.select] and send them to the
533+
channels using [`select()`][frequenz.channels.select] and send them to the
534534
output channel. The `run()` method will stop if a `False` message is received.
535535
536536
3. We create the channels that will be used with the actor.
@@ -551,20 +551,20 @@ async def main() -> None: # (6)!
551551
9. We start the actor and wait for it to finish using the
552552
[`run()`][frequenz.sdk.actor.run] function.
553553
554-
10. The [`select()`][frequenz.channels.util.select] function will get the first message
554+
10. The [`select()`][frequenz.channels.select] function will get the first message
555555
available from the two channels. The order in which they will be handled is
556556
unknown, but in this example we assume that the first message will be from
557557
`input_channel_1` (`True`) and the second from `input_channel_1` (`False`).
558558
559-
11. The [`selected_from()`][frequenz.channels.util.selected_from] function will return
559+
11. The [`selected_from()`][frequenz.channels.selected_from] function will return
560560
`True` for the `input_channel_1` receiver. `selected.value` holds the received
561561
message, so `"Received from receiver_1: True"` will be printed and `True` will be
562562
sent to the `output` channel.
563563
564564
12. Since `selected.value` is `True`, the loop will continue, going back to the
565-
[`select()`][frequenz.channels.util.select] function.
565+
[`select()`][frequenz.channels.select] function.
566566
567-
13. The [`selected_from()`][frequenz.channels.util.selected_from] function will return
567+
13. The [`selected_from()`][frequenz.channels.selected_from] function will return
568568
`False` for the `input_channel_1` receiver and `True` for the `input_channel_2`
569569
receiver. The message stored in `selected.value` will now be `False`, so
570570
`"Received from receiver_2: False"` will be printed and `False` will be sent to the

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
from frequenz.channels import LatestValueCache, Receiver, Sender
1414
from frequenz.client.microgrid import (
15+
ApiClientError,
1516
BatteryData,
16-
ClientError,
1717
ComponentCategory,
1818
InverterData,
1919
OperationOutOfRange,
@@ -670,7 +670,7 @@ def _parse_result(
670670
battery_ids,
671671
err,
672672
)
673-
except ClientError as err:
673+
except ApiClientError as err:
674674
_logger.warning(
675675
"Set power for battery %s failed, mark it as broken. Error: %s",
676676
battery_ids,

src/frequenz/sdk/microgrid/_power_distributing/_component_managers/_ev_charger_manager/_ev_charger_manager.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
)
1919
from frequenz.client.microgrid import (
2020
ApiClient,
21-
ClientError,
21+
ApiClientError,
2222
ComponentCategory,
2323
EVChargerData,
2424
)
@@ -339,7 +339,7 @@ async def _set_api_power(
339339
_logger.warning(
340340
"Timeout while setting power to EV charger %s", component_id
341341
)
342-
except ClientError as exc:
342+
except ApiClientError as exc:
343343
_logger.warning(
344344
"Got a client error while setting power to EV charger %s: %s",
345345
component_id,

src/frequenz/sdk/microgrid/_power_distributing/_component_managers/_pv_inverter_manager/_pv_inverter_manager.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from frequenz.channels import Broadcast, LatestValueCache, Sender
1212
from frequenz.client.microgrid import (
13-
ClientError,
13+
ApiClientError,
1414
ComponentCategory,
1515
InverterData,
1616
InverterType,
@@ -211,7 +211,7 @@ async def _set_api_power( # pylint: disable=too-many-locals
211211
_logger.warning(
212212
"Timeout while setting power to PV inverter %s", component_id
213213
)
214-
except ClientError as exc:
214+
except ApiClientError as exc:
215215
_logger.warning(
216216
"Got a client error while setting power to PV inverter %s: %s",
217217
component_id,

tests/microgrid/test_microgrid_api.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def metadata(self) -> Metadata:
104104
),
105105
)
106106

107-
@mock.patch("grpclib.client.Channel")
107+
@mock.patch("grpc.aio.insecure_channel")
108108
async def test_connection_manager(
109109
self,
110110
_insecure_channel_mock: MagicMock,
@@ -185,7 +185,7 @@ async def test_connection_manager(
185185
assert api.microgrid_id == metadata.microgrid_id
186186
assert api.location == metadata.location
187187

188-
@mock.patch("grpclib.client.Channel")
188+
@mock.patch("grpc.aio.insecure_channel")
189189
async def test_connection_manager_another_method(
190190
self,
191191
_insecure_channel_mock: MagicMock,

0 commit comments

Comments
 (0)