Skip to content

Commit bfcccbc

Browse files
committed
Upgrade client-base to v0.2.0
Signed-off-by: Leandro Lucarella <[email protected]>
1 parent aa775a7 commit bfcccbc

File tree

5 files changed

+9
-18
lines changed

5 files changed

+9
-18
lines changed

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ plugins:
118118
- https://frequenz-floss.github.io/frequenz-api-common/v0.5/objects.inv
119119
- https://frequenz-floss.github.io/frequenz-api-microgrid/v0.15/objects.inv
120120
- https://frequenz-floss.github.io/frequenz-channels-python/v1.0-pre/objects.inv
121-
- https://frequenz-floss.github.io/frequenz-client-base-python/v0.2-dev/objects.inv
121+
- https://frequenz-floss.github.io/frequenz-client-base-python/v0.2/objects.inv
122122
- https://grpc.github.io/grpc/python/objects.inv
123123
- https://typing-extensions.readthedocs.io/en/stable/objects.inv
124124
# Note this plugin must be loaded after mkdocstrings to be able to use macros

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ requires-python = ">= 3.11, < 4"
3838
dependencies = [
3939
"frequenz-api-microgrid >= 0.15.3, < 0.16.0",
4040
"frequenz-channels == 1.0.0b2",
41-
"frequenz-client-base @ git+https://github.com/frequenz-floss/frequenz-client-base-python.git@03f2ed2104efc1bdad05eed68db167e87eb8b1aa",
41+
"frequenz-client-base >= 0.2.0, < 0.3.0",
4242
"grpcio >= 1.54.2, < 2",
4343
"protobuf >= 4.25.3, < 5",
4444
"timezonefinder >= 6.2.0, < 7",

src/frequenz/client/microgrid/__init__.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
"""
88

99

10-
from frequenz.client.base.retry_strategy import (
11-
ExponentialBackoff,
12-
LinearBackoff,
13-
RetryStrategy,
14-
)
15-
1610
from ._client import ApiClient
1711
from ._component import Component
1812
from ._component_data import (
@@ -35,11 +29,8 @@
3529
"EVChargerCableState",
3630
"EVChargerComponentState",
3731
"EVChargerData",
38-
"ExponentialBackoff",
3932
"InverterData",
40-
"LinearBackoff",
4133
"Location",
4234
"Metadata",
4335
"MeterData",
44-
"RetryStrategy",
4536
]

src/frequenz/client/microgrid/_client.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030

3131
# pylint: enable=no-name-in-module
3232
from frequenz.channels import Receiver
33-
from frequenz.client.base.grpc_streaming_helper import GrpcStreamingHelper
34-
from frequenz.client.base.retry_strategy import LinearBackoff, RetryStrategy
33+
from frequenz.client.base import retry, streaming
3534
from google.protobuf.empty_pb2 import Empty # pylint: disable=no-name-in-module
3635

3736
from ._component import (
@@ -68,7 +67,7 @@ def __init__(
6867
self,
6968
grpc_channel: grpc.aio.Channel,
7069
target: str,
71-
retry_spec: RetryStrategy = LinearBackoff(),
70+
retry_spec: retry.Strategy = retry.LinearBackoff(),
7271
) -> None:
7372
"""Initialize the class instance.
7473
@@ -85,7 +84,7 @@ def __init__(
8584
self.api = MicrogridStub(grpc_channel)
8685
"""The gRPC stub for the microgrid API."""
8786

88-
self._broadcasters: dict[int, GrpcStreamingHelper[Any, Any]] = {}
87+
self._broadcasters: dict[int, streaming.GrpcStreamBroadcaster[Any, Any]] = {}
8988
self._retry_spec = retry_spec
9089

9190
async def components(self) -> Iterable[Component]:
@@ -264,7 +263,7 @@ async def _new_component_data_receiver(
264263

265264
broadcaster = self._broadcasters.setdefault(
266265
component_id,
267-
GrpcStreamingHelper(
266+
streaming.GrpcStreamBroadcaster(
268267
f"raw-component-data-{component_id}",
269268
# We need to cast here because grpc says StreamComponentData is
270269
# a grpc.CallIterator[PbComponentData], not a

tests/test_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
from frequenz.api.microgrid.microgrid_pb2 import ConnectionFilter as PbConnectionFilter
1919
from frequenz.api.microgrid.microgrid_pb2 import ConnectionList as PbConnectionList
2020
from frequenz.api.microgrid.microgrid_pb2 import SetBoundsParam as PbSetBoundsParam
21-
from frequenz.client.base.retry_strategy import LinearBackoff
22-
from google.protobuf.empty_pb2 import Empty
2321

2422
# pylint: enable=no-name-in-module
23+
from frequenz.client.base.retry import LinearBackoff
24+
from google.protobuf.empty_pb2 import Empty # pylint: disable=no-name-in-module
25+
2526
from frequenz.client.microgrid import _client as client
2627
from frequenz.client.microgrid._component import (
2728
Component,

0 commit comments

Comments
 (0)