frequenz-client-microgrid 0.5.0__tar.gz → 0.5.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/PKG-INFO +1 -1
- frequenz-client-microgrid-0.5.2/RELEASE_NOTES.md +5 -0
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/pyproject.toml +6 -4
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/src/frequenz/client/microgrid/_client.py +52 -2
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/src/frequenz_client_microgrid.egg-info/PKG-INFO +1 -1
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/src/frequenz_client_microgrid.egg-info/requires.txt +6 -4
- frequenz-client-microgrid-0.5.0/RELEASE_NOTES.md +0 -10
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/LICENSE +0 -0
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/MANIFEST.in +0 -0
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/README.md +0 -0
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/setup.cfg +0 -0
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/src/frequenz/client/microgrid/__init__.py +0 -0
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/src/frequenz/client/microgrid/_component.py +0 -0
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/src/frequenz/client/microgrid/_component_data.py +0 -0
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/src/frequenz/client/microgrid/_component_error.py +0 -0
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/src/frequenz/client/microgrid/_component_states.py +0 -0
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/src/frequenz/client/microgrid/_connection.py +0 -0
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/src/frequenz/client/microgrid/_constants.py +0 -0
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/src/frequenz/client/microgrid/_exception.py +0 -0
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/src/frequenz/client/microgrid/_metadata.py +0 -0
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/src/frequenz/client/microgrid/conftest.py +0 -0
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/src/frequenz/client/microgrid/py.typed +0 -0
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/src/frequenz_client_microgrid.egg-info/SOURCES.txt +0 -0
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/src/frequenz_client_microgrid.egg-info/dependency_links.txt +0 -0
- {frequenz-client-microgrid-0.5.0 → frequenz-client-microgrid-0.5.2}/src/frequenz_client_microgrid.egg-info/top_level.txt +0 -0
|
@@ -66,20 +66,22 @@ dev-mkdocs = [
|
|
|
66
66
|
"mkdocs-gen-files == 0.5.0",
|
|
67
67
|
"mkdocs-literate-nav == 0.6.1",
|
|
68
68
|
"mkdocs-macros-plugin == 1.0.5",
|
|
69
|
-
"mkdocs-material == 9.5.
|
|
70
|
-
"mkdocstrings[python] == 0.
|
|
71
|
-
"mkdocstrings-python == 1.10.
|
|
69
|
+
"mkdocs-material == 9.5.34",
|
|
70
|
+
"mkdocstrings[python] == 0.26.0",
|
|
71
|
+
"mkdocstrings-python == 1.10.9",
|
|
72
72
|
"frequenz-repo-config[lib] == 0.10.0",
|
|
73
73
|
]
|
|
74
74
|
dev-mypy = [
|
|
75
75
|
"mypy == 1.11.2",
|
|
76
|
+
"grpc-stubs == 1.53.0.5",
|
|
76
77
|
"types-Markdown == 3.7.0.20240822",
|
|
78
|
+
"types-protobuf == 5.28.3.20241030",
|
|
77
79
|
# For checking the noxfile, docs/ script, and tests
|
|
78
80
|
"frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]",
|
|
79
81
|
]
|
|
80
82
|
dev-noxfile = ["nox == 2024.4.15", "frequenz-repo-config[lib] == 0.10.0"]
|
|
81
83
|
dev-pylint = [
|
|
82
|
-
"pylint == 3.2.
|
|
84
|
+
"pylint == 3.2.7",
|
|
83
85
|
# For checking the noxfile, docs/ script, and tests
|
|
84
86
|
"frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]",
|
|
85
87
|
]
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import asyncio
|
|
7
7
|
import logging
|
|
8
8
|
from collections.abc import AsyncIterator, Awaitable, Callable, Iterable, Set
|
|
9
|
+
from dataclasses import replace
|
|
9
10
|
from typing import Any, TypeVar, cast
|
|
10
11
|
|
|
11
12
|
import grpc.aio
|
|
@@ -44,6 +45,16 @@ _ComponentDataT = TypeVar("_ComponentDataT", bound=ComponentData)
|
|
|
44
45
|
_logger = logging.getLogger(__name__)
|
|
45
46
|
|
|
46
47
|
|
|
48
|
+
DEFAULT_CHANNEL_OPTIONS = replace(
|
|
49
|
+
channel.ChannelOptions(), ssl=channel.SslOptions(enabled=False)
|
|
50
|
+
)
|
|
51
|
+
"""The default channel options for the microgrid API client.
|
|
52
|
+
|
|
53
|
+
These are the same defaults as the common default options but with SSL disabled, as the
|
|
54
|
+
microgrid API does not use SSL by default.
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
|
|
47
58
|
class ApiClient:
|
|
48
59
|
"""A microgrid API client."""
|
|
49
60
|
|
|
@@ -51,6 +62,7 @@ class ApiClient:
|
|
|
51
62
|
self,
|
|
52
63
|
server_url: str,
|
|
53
64
|
*,
|
|
65
|
+
channel_options: channel.ChannelOptions = DEFAULT_CHANNEL_OPTIONS,
|
|
54
66
|
retry_strategy: retry.Strategy | None = None,
|
|
55
67
|
) -> None:
|
|
56
68
|
"""Initialize the class instance.
|
|
@@ -62,6 +74,8 @@ class ApiClient:
|
|
|
62
74
|
where the `port` should be an int between 0 and 65535 (defaulting to
|
|
63
75
|
9090) and `ssl` should be a boolean (defaulting to `false`).
|
|
64
76
|
For example: `grpc://localhost:1090?ssl=true`.
|
|
77
|
+
channel_options: The default options use to create the channel when not
|
|
78
|
+
specified in the URL.
|
|
65
79
|
retry_strategy: The retry strategy to use to reconnect when the connection
|
|
66
80
|
to the streaming method is lost. By default a linear backoff strategy
|
|
67
81
|
is used.
|
|
@@ -69,7 +83,9 @@ class ApiClient:
|
|
|
69
83
|
self._server_url = server_url
|
|
70
84
|
"""The location of the microgrid API server as a URL."""
|
|
71
85
|
|
|
72
|
-
self.api = microgrid_pb2_grpc.MicrogridStub(
|
|
86
|
+
self.api = microgrid_pb2_grpc.MicrogridStub(
|
|
87
|
+
channel.parse_grpc_uri(server_url, defaults=channel_options)
|
|
88
|
+
)
|
|
73
89
|
"""The gRPC stub for the microgrid API."""
|
|
74
90
|
|
|
75
91
|
self._broadcasters: dict[int, streaming.GrpcStreamBroadcaster[Any, Any]] = {}
|
|
@@ -425,7 +441,41 @@ class ApiClient:
|
|
|
425
441
|
grpc_error=grpc_error,
|
|
426
442
|
) from grpc_error
|
|
427
443
|
|
|
428
|
-
async def
|
|
444
|
+
async def set_reactive_power( # noqa: DOC502 (raises ApiClientError indirectly)
|
|
445
|
+
self, component_id: int, reactive_power_var: float
|
|
446
|
+
) -> None:
|
|
447
|
+
"""Send request to the Microgrid to set reactive power for component.
|
|
448
|
+
|
|
449
|
+
Negative values are for inductive (lagging) power , and positive values are for
|
|
450
|
+
capacitive (leading) power.
|
|
451
|
+
|
|
452
|
+
Args:
|
|
453
|
+
component_id: id of the component to set power.
|
|
454
|
+
reactive_power_var: reactive power to set for the component.
|
|
455
|
+
|
|
456
|
+
Raises:
|
|
457
|
+
ApiClientError: If the are any errors communicating with the Microgrid API,
|
|
458
|
+
most likely a subclass of
|
|
459
|
+
[GrpcError][frequenz.client.microgrid.GrpcError].
|
|
460
|
+
"""
|
|
461
|
+
try:
|
|
462
|
+
await cast(
|
|
463
|
+
Awaitable[Empty],
|
|
464
|
+
self.api.SetPowerReactive(
|
|
465
|
+
microgrid_pb2.SetPowerReactiveParam(
|
|
466
|
+
component_id=component_id, power=reactive_power_var
|
|
467
|
+
),
|
|
468
|
+
timeout=int(DEFAULT_GRPC_CALL_TIMEOUT),
|
|
469
|
+
),
|
|
470
|
+
)
|
|
471
|
+
except grpc.aio.AioRpcError as grpc_error:
|
|
472
|
+
raise ApiClientError.from_grpc_error(
|
|
473
|
+
server_url=self._server_url,
|
|
474
|
+
operation="SetPowerReactive",
|
|
475
|
+
grpc_error=grpc_error,
|
|
476
|
+
) from grpc_error
|
|
477
|
+
|
|
478
|
+
async def set_bounds( # noqa: DOC503 (raises ApiClientError indirectly)
|
|
429
479
|
self,
|
|
430
480
|
component_id: int,
|
|
431
481
|
lower: float,
|
|
@@ -27,14 +27,16 @@ mike==2.1.3
|
|
|
27
27
|
mkdocs-gen-files==0.5.0
|
|
28
28
|
mkdocs-literate-nav==0.6.1
|
|
29
29
|
mkdocs-macros-plugin==1.0.5
|
|
30
|
-
mkdocs-material==9.5.
|
|
31
|
-
mkdocstrings[python]==0.
|
|
32
|
-
mkdocstrings-python==1.10.
|
|
30
|
+
mkdocs-material==9.5.34
|
|
31
|
+
mkdocstrings[python]==0.26.0
|
|
32
|
+
mkdocstrings-python==1.10.9
|
|
33
33
|
frequenz-repo-config[lib]==0.10.0
|
|
34
34
|
|
|
35
35
|
[dev-mypy]
|
|
36
36
|
mypy==1.11.2
|
|
37
|
+
grpc-stubs==1.53.0.5
|
|
37
38
|
types-Markdown==3.7.0.20240822
|
|
39
|
+
types-protobuf==5.28.3.20241030
|
|
38
40
|
frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]
|
|
39
41
|
|
|
40
42
|
[dev-noxfile]
|
|
@@ -42,7 +44,7 @@ nox==2024.4.15
|
|
|
42
44
|
frequenz-repo-config[lib]==0.10.0
|
|
43
45
|
|
|
44
46
|
[dev-pylint]
|
|
45
|
-
pylint==3.2.
|
|
47
|
+
pylint==3.2.7
|
|
46
48
|
frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]
|
|
47
49
|
|
|
48
50
|
[dev-pytest]
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# Frequenz Microgrid API Client Release Notes
|
|
2
|
-
|
|
3
|
-
## Upgrading
|
|
4
|
-
|
|
5
|
-
- This release stops using `betterproto` and `grpclib` as backend for gRPC and goes back to using Google's `grpcio` and `protobuf`.
|
|
6
|
-
|
|
7
|
-
If your code was using `betterproto` and `grpclib`, it now needs to be ported to use `grpcio` and `protobuf` too. Remember to also remove any `betterproto` and `grpclib` dependencies from your project.
|
|
8
|
-
|
|
9
|
-
- We are now using base-client v0.6.0.
|
|
10
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|