Skip to content

Commit 12205d7

Browse files
committed
Bump the frequnz-client-base dependency to 0.6.0
We also start using the new `exceptions` module from that library right away to avoid having to port the local copy to use grpcio. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 94f030e commit 12205d7

File tree

6 files changed

+65
-836
lines changed

6 files changed

+65
-836
lines changed

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.0-rc1, < 2.0.0",
41-
"frequenz-client-base[grpclib] >= 0.4.0, < 0.5",
41+
"frequenz-client-base >= 0.6.0, < 0.7",
4242
"grpcio >= 1.54.2, < 2",
4343
"protobuf >= 4.21.6, < 6",
4444
"timezonefinder >= 6.2.0, < 7",

src/frequenz/client/microgrid/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
)
4242
from ._connection import Connection
4343
from ._exception import (
44-
ClientError,
44+
ApiClientError,
45+
ClientNotConnected,
4546
DataLoss,
4647
EntityAlreadyExists,
4748
EntityNotFound,
@@ -65,12 +66,13 @@
6566

6667
__all__ = [
6768
"ApiClient",
69+
"ApiClientError",
6870
"BatteryComponentState",
6971
"BatteryData",
7072
"BatteryError",
7173
"BatteryErrorCode",
7274
"BatteryRelayState",
73-
"ClientError",
75+
"ClientNotConnected",
7476
"Component",
7577
"ComponentCategory",
7678
"ComponentData",

src/frequenz/client/microgrid/_client.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
)
5151
from ._connection import Connection
5252
from ._constants import RECEIVER_MAX_SIZE
53-
from ._exception import ClientError
53+
from ._exception import ApiClientError
5454
from ._metadata import Location, Metadata
5555

5656
DEFAULT_GRPC_CALL_TIMEOUT = 60.0
@@ -105,7 +105,7 @@ async def components(self) -> Iterable[Component]:
105105
Iterator whose elements are all the components in the microgrid.
106106
107107
Raises:
108-
ClientError: If the are any errors communicating with the Microgrid API,
108+
ApiClientError: If the are any errors communicating with the Microgrid API,
109109
most likely a subclass of
110110
[GrpcError][frequenz.client.microgrid.GrpcError].
111111
"""
@@ -120,7 +120,7 @@ async def components(self) -> Iterable[Component]:
120120
),
121121
)
122122
except grpc.aio.AioRpcError as grpc_error:
123-
raise ClientError.from_grpc_error(
123+
raise ApiClientError.from_grpc_error(
124124
server_url=self._server_url,
125125
operation="ListComponents",
126126
grpc_error=grpc_error,
@@ -192,7 +192,7 @@ async def connections(
192192
Microgrid connections matching the provided start and end filters.
193193
194194
Raises:
195-
ClientError: If the are any errors communicating with the Microgrid API,
195+
ApiClientError: If the are any errors communicating with the Microgrid API,
196196
most likely a subclass of
197197
[GrpcError][frequenz.client.microgrid.GrpcError].
198198
"""
@@ -211,7 +211,7 @@ async def connections(
211211
),
212212
)
213213
except grpc.aio.AioRpcError as grpc_error:
214-
raise ClientError.from_grpc_error(
214+
raise ApiClientError.from_grpc_error(
215215
server_url=self._server_url,
216216
operation="ListConnections",
217217
grpc_error=grpc_error,
@@ -419,7 +419,7 @@ async def set_power(self, component_id: int, power_w: float) -> None:
419419
power_w: power to set for the component.
420420
421421
Raises:
422-
ClientError: If the are any errors communicating with the Microgrid API,
422+
ApiClientError: If the are any errors communicating with the Microgrid API,
423423
most likely a subclass of
424424
[GrpcError][frequenz.client.microgrid.GrpcError].
425425
"""
@@ -432,7 +432,7 @@ async def set_power(self, component_id: int, power_w: float) -> None:
432432
),
433433
)
434434
except grpc.aio.AioRpcError as grpc_error:
435-
raise ClientError.from_grpc_error(
435+
raise ApiClientError.from_grpc_error(
436436
server_url=self._server_url,
437437
operation="SetPowerActive",
438438
grpc_error=grpc_error,
@@ -454,7 +454,7 @@ async def set_bounds(
454454
Raises:
455455
ValueError: when upper bound is less than 0, or when lower bound is
456456
greater than 0.
457-
ClientError: If the are any errors communicating with the Microgrid API,
457+
ApiClientError: If the are any errors communicating with the Microgrid API,
458458
most likely a subclass of
459459
[GrpcError][frequenz.client.microgrid.GrpcError].
460460
"""
@@ -477,7 +477,7 @@ async def set_bounds(
477477
),
478478
)
479479
except grpc.aio.AioRpcError as grpc_error:
480-
raise ClientError.from_grpc_error(
480+
raise ApiClientError.from_grpc_error(
481481
server_url=self._server_url,
482482
operation="AddInclusionBounds",
483483
grpc_error=grpc_error,

0 commit comments

Comments
 (0)