frequenz-client-microgrid 0.8.0__tar.gz → 0.9.0__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.8.0/src/frequenz_client_microgrid.egg-info → frequenz_client_microgrid-0.9.0}/PKG-INFO +16 -15
- frequenz_client_microgrid-0.9.0/RELEASE_NOTES.md +14 -0
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/pyproject.toml +26 -17
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz/client/microgrid/_client.py +3 -1
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz/client/microgrid/_component.py +1 -2
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz/client/microgrid/_component_data.py +1 -1
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz/client/microgrid/_connection.py +1 -1
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz/client/microgrid/_metadata.py +1 -2
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz/client/microgrid/_sensor_proto.py +1 -1
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz/client/microgrid/sensor.py +1 -1
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0/src/frequenz_client_microgrid.egg-info}/PKG-INFO +16 -15
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz_client_microgrid.egg-info/SOURCES.txt +0 -1
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz_client_microgrid.egg-info/requires.txt +15 -14
- frequenz_client_microgrid-0.8.0/RELEASE_NOTES.md +0 -18
- frequenz_client_microgrid-0.8.0/src/frequenz/client/microgrid/id.py +0 -218
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/LICENSE +0 -0
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/MANIFEST.in +0 -0
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/README.md +0 -0
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/setup.cfg +0 -0
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz/client/microgrid/__init__.py +0 -0
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz/client/microgrid/_component_error.py +0 -0
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz/client/microgrid/_component_states.py +0 -0
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz/client/microgrid/_constants.py +0 -0
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz/client/microgrid/_exception.py +0 -0
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz/client/microgrid/_lifetime.py +0 -0
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz/client/microgrid/_util.py +0 -0
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz/client/microgrid/conftest.py +0 -0
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz/client/microgrid/metrics.py +0 -0
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz/client/microgrid/py.typed +0 -0
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz_client_microgrid.egg-info/dependency_links.txt +0 -0
- {frequenz_client_microgrid-0.8.0 → frequenz_client_microgrid-0.9.0}/src/frequenz_client_microgrid.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: frequenz-client-microgrid
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.0
|
|
4
4
|
Summary: Microgrid API client for Python
|
|
5
5
|
Author-email: Frequenz Energy-as-a-Service GmbH <floss@frequenz.com>
|
|
6
6
|
License: MIT
|
|
@@ -21,13 +21,14 @@ Classifier: Typing :: Typed
|
|
|
21
21
|
Requires-Python: <4,>=3.11
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
License-File: LICENSE
|
|
24
|
-
Requires-Dist: frequenz-api-microgrid<0.16.0,>=0.15.
|
|
24
|
+
Requires-Dist: frequenz-api-microgrid<0.16.0,>=0.15.5
|
|
25
25
|
Requires-Dist: frequenz-channels<2.0.0,>=1.0.0-rc1
|
|
26
|
-
Requires-Dist: frequenz-client-base<0.
|
|
27
|
-
Requires-Dist:
|
|
28
|
-
Requires-Dist:
|
|
26
|
+
Requires-Dist: frequenz-client-base<0.12.0,>=0.8.0
|
|
27
|
+
Requires-Dist: frequenz-client-common<0.4.0,>=0.3.2
|
|
28
|
+
Requires-Dist: grpcio<2,>=1.63.0
|
|
29
|
+
Requires-Dist: protobuf<7,>=5.26.1
|
|
29
30
|
Requires-Dist: timezonefinder<7,>=6.2.0
|
|
30
|
-
Requires-Dist: typing-extensions<5,>=4.
|
|
31
|
+
Requires-Dist: typing-extensions<5,>=4.13.0
|
|
31
32
|
Provides-Extra: dev-flake8
|
|
32
33
|
Requires-Dist: flake8==7.2.0; extra == "dev-flake8"
|
|
33
34
|
Requires-Dist: flake8-docstrings==1.7.0; extra == "dev-flake8"
|
|
@@ -44,26 +45,26 @@ Requires-Dist: mike==2.1.3; extra == "dev-mkdocs"
|
|
|
44
45
|
Requires-Dist: mkdocs-gen-files==0.5.0; extra == "dev-mkdocs"
|
|
45
46
|
Requires-Dist: mkdocs-literate-nav==0.6.2; extra == "dev-mkdocs"
|
|
46
47
|
Requires-Dist: mkdocs-macros-plugin==1.3.7; extra == "dev-mkdocs"
|
|
47
|
-
Requires-Dist: mkdocs-material==9.6.
|
|
48
|
+
Requires-Dist: mkdocs-material==9.6.14; extra == "dev-mkdocs"
|
|
48
49
|
Requires-Dist: mkdocstrings[python]==0.29.1; extra == "dev-mkdocs"
|
|
49
|
-
Requires-Dist: mkdocstrings-python==1.16.
|
|
50
|
-
Requires-Dist: frequenz-repo-config[lib]==0.13.
|
|
50
|
+
Requires-Dist: mkdocstrings-python==1.16.11; extra == "dev-mkdocs"
|
|
51
|
+
Requires-Dist: frequenz-repo-config[lib]==0.13.4; extra == "dev-mkdocs"
|
|
51
52
|
Provides-Extra: dev-mypy
|
|
52
|
-
Requires-Dist: mypy==1.
|
|
53
|
+
Requires-Dist: mypy==1.16.0; extra == "dev-mypy"
|
|
53
54
|
Requires-Dist: grpc-stubs==1.53.0.6; extra == "dev-mypy"
|
|
54
55
|
Requires-Dist: types-Markdown==3.8.0.20250415; extra == "dev-mypy"
|
|
55
|
-
Requires-Dist: types-protobuf==
|
|
56
|
+
Requires-Dist: types-protobuf==6.30.2.20250516; extra == "dev-mypy"
|
|
56
57
|
Requires-Dist: frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]; extra == "dev-mypy"
|
|
57
58
|
Provides-Extra: dev-noxfile
|
|
58
59
|
Requires-Dist: nox==2025.5.1; extra == "dev-noxfile"
|
|
59
|
-
Requires-Dist: frequenz-repo-config[lib]==0.13.
|
|
60
|
+
Requires-Dist: frequenz-repo-config[lib]==0.13.4; extra == "dev-noxfile"
|
|
60
61
|
Provides-Extra: dev-pylint
|
|
61
|
-
Requires-Dist: pylint==3.3.
|
|
62
|
+
Requires-Dist: pylint==3.3.7; extra == "dev-pylint"
|
|
62
63
|
Requires-Dist: frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]; extra == "dev-pylint"
|
|
63
64
|
Provides-Extra: dev-pytest
|
|
64
65
|
Requires-Dist: pytest==8.3.5; extra == "dev-pytest"
|
|
65
|
-
Requires-Dist: frequenz-repo-config[extra-lint-examples]==0.13.
|
|
66
|
-
Requires-Dist: pytest-mock==3.14.
|
|
66
|
+
Requires-Dist: frequenz-repo-config[extra-lint-examples]==0.13.4; extra == "dev-pytest"
|
|
67
|
+
Requires-Dist: pytest-mock==3.14.1; extra == "dev-pytest"
|
|
67
68
|
Requires-Dist: pytest-asyncio==0.26.0; extra == "dev-pytest"
|
|
68
69
|
Requires-Dist: async-solipsism==0.7; extra == "dev-pytest"
|
|
69
70
|
Provides-Extra: dev
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Frequenz Microgrid API Client Release Notes
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
This is a small release to allow for easier interoperability between different APIs.
|
|
6
|
+
|
|
7
|
+
## Upgrading
|
|
8
|
+
|
|
9
|
+
- Some minimum dependency versions are bumped, so you might need to update your dependencies as well.
|
|
10
|
+
- The IDs (`MicrogridId`, `ComponentId`, `SensorId`) are now imported from `frequenz-client-common`. Please add it to your dependencies if you haven't already, then you can replace your imports:
|
|
11
|
+
|
|
12
|
+
* `from frequenz.client.microgrid import MicrogridId` -> `from frequenz.client.common.microgrid import MicrogridId`
|
|
13
|
+
* `from frequenz.client.microgrid import ComponentId` -> `from frequenz.client.common.microgrid.components import ComponentId`
|
|
14
|
+
* `from frequenz.client.microgrid import SensorId` -> `from frequenz.client.common.microgrid.sensors import SensorId`
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
[build-system]
|
|
5
5
|
requires = [
|
|
6
|
-
"setuptools == 80.
|
|
6
|
+
"setuptools == 80.9.0",
|
|
7
7
|
"setuptools_scm[toml] == 8.3.1",
|
|
8
|
-
"frequenz-repo-config[lib] == 0.13.
|
|
8
|
+
"frequenz-repo-config[lib] == 0.13.4",
|
|
9
9
|
]
|
|
10
10
|
build-backend = "setuptools.build_meta"
|
|
11
11
|
|
|
@@ -36,13 +36,14 @@ classifiers = [
|
|
|
36
36
|
]
|
|
37
37
|
requires-python = ">= 3.11, < 4"
|
|
38
38
|
dependencies = [
|
|
39
|
-
"frequenz-api-microgrid >= 0.15.
|
|
39
|
+
"frequenz-api-microgrid >= 0.15.5, < 0.16.0",
|
|
40
40
|
"frequenz-channels >= 1.0.0-rc1, < 2.0.0",
|
|
41
|
-
"frequenz-client-base >= 0.8.0, < 0.
|
|
42
|
-
"
|
|
43
|
-
"
|
|
41
|
+
"frequenz-client-base >= 0.8.0, < 0.12.0",
|
|
42
|
+
"frequenz-client-common >= 0.3.2, < 0.4.0",
|
|
43
|
+
"grpcio >= 1.63.0, < 2",
|
|
44
|
+
"protobuf >= 5.26.1, < 7",
|
|
44
45
|
"timezonefinder >= 6.2.0, < 7",
|
|
45
|
-
"typing-extensions >= 4.
|
|
46
|
+
"typing-extensions >= 4.13.0, < 5",
|
|
46
47
|
]
|
|
47
48
|
dynamic = ["version"]
|
|
48
49
|
|
|
@@ -66,29 +67,29 @@ dev-mkdocs = [
|
|
|
66
67
|
"mkdocs-gen-files == 0.5.0",
|
|
67
68
|
"mkdocs-literate-nav == 0.6.2",
|
|
68
69
|
"mkdocs-macros-plugin == 1.3.7",
|
|
69
|
-
"mkdocs-material == 9.6.
|
|
70
|
+
"mkdocs-material == 9.6.14",
|
|
70
71
|
"mkdocstrings[python] == 0.29.1",
|
|
71
|
-
"mkdocstrings-python == 1.16.
|
|
72
|
-
"frequenz-repo-config[lib] == 0.13.
|
|
72
|
+
"mkdocstrings-python == 1.16.11",
|
|
73
|
+
"frequenz-repo-config[lib] == 0.13.4",
|
|
73
74
|
]
|
|
74
75
|
dev-mypy = [
|
|
75
|
-
"mypy == 1.
|
|
76
|
+
"mypy == 1.16.0",
|
|
76
77
|
"grpc-stubs == 1.53.0.6",
|
|
77
78
|
"types-Markdown == 3.8.0.20250415",
|
|
78
|
-
"types-protobuf ==
|
|
79
|
+
"types-protobuf == 6.30.2.20250516",
|
|
79
80
|
# For checking the noxfile, docs/ script, and tests
|
|
80
81
|
"frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]",
|
|
81
82
|
]
|
|
82
|
-
dev-noxfile = ["nox == 2025.5.1", "frequenz-repo-config[lib] == 0.13.
|
|
83
|
+
dev-noxfile = ["nox == 2025.5.1", "frequenz-repo-config[lib] == 0.13.4"]
|
|
83
84
|
dev-pylint = [
|
|
84
|
-
"pylint == 3.3.
|
|
85
|
+
"pylint == 3.3.7",
|
|
85
86
|
# For checking the noxfile, docs/ script, and tests
|
|
86
87
|
"frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]",
|
|
87
88
|
]
|
|
88
89
|
dev-pytest = [
|
|
89
90
|
"pytest == 8.3.5",
|
|
90
|
-
"frequenz-repo-config[extra-lint-examples] == 0.13.
|
|
91
|
-
"pytest-mock == 3.14.
|
|
91
|
+
"frequenz-repo-config[extra-lint-examples] == 0.13.4",
|
|
92
|
+
"pytest-mock == 3.14.1",
|
|
92
93
|
"pytest-asyncio == 0.26.0",
|
|
93
94
|
"async-solipsism == 0.7",
|
|
94
95
|
]
|
|
@@ -161,7 +162,15 @@ disable = [
|
|
|
161
162
|
]
|
|
162
163
|
|
|
163
164
|
[tool.pytest.ini_options]
|
|
164
|
-
addopts = "-
|
|
165
|
+
addopts = "-vv"
|
|
166
|
+
filterwarnings = [
|
|
167
|
+
"error",
|
|
168
|
+
"once::DeprecationWarning",
|
|
169
|
+
"once::PendingDeprecationWarning",
|
|
170
|
+
# We use a raw string (single quote) to avoid the need to escape special
|
|
171
|
+
# chars as this is a regex
|
|
172
|
+
'ignore:Protobuf gencode version .*exactly one major version older.*:UserWarning',
|
|
173
|
+
]
|
|
165
174
|
testpaths = ["tests", "src"]
|
|
166
175
|
asyncio_mode = "auto"
|
|
167
176
|
asyncio_default_fixture_loop_scope = "function"
|
|
@@ -17,6 +17,9 @@ from frequenz.api.common import components_pb2, metrics_pb2
|
|
|
17
17
|
from frequenz.api.microgrid import microgrid_pb2, microgrid_pb2_grpc, sensor_pb2
|
|
18
18
|
from frequenz.channels import Receiver
|
|
19
19
|
from frequenz.client.base import channel, client, retry, streaming
|
|
20
|
+
from frequenz.client.common.microgrid import MicrogridId
|
|
21
|
+
from frequenz.client.common.microgrid.components import ComponentId
|
|
22
|
+
from frequenz.client.common.microgrid.sensors import SensorId
|
|
20
23
|
from google.protobuf.empty_pb2 import Empty
|
|
21
24
|
from typing_extensions import override
|
|
22
25
|
|
|
@@ -39,7 +42,6 @@ from ._constants import RECEIVER_MAX_SIZE
|
|
|
39
42
|
from ._exception import ApiClientError, ClientNotConnected
|
|
40
43
|
from ._metadata import Location, Metadata
|
|
41
44
|
from ._sensor_proto import sensor_data_samples_from_proto, sensor_from_proto
|
|
42
|
-
from .id import ComponentId, MicrogridId, SensorId
|
|
43
45
|
from .sensor import Sensor, SensorDataSamples, SensorMetric
|
|
44
46
|
|
|
45
47
|
DEFAULT_GRPC_CALL_TIMEOUT = 60.0
|
|
@@ -8,8 +8,7 @@ from enum import Enum
|
|
|
8
8
|
|
|
9
9
|
from frequenz.api.common import components_pb2
|
|
10
10
|
from frequenz.api.microgrid import grid_pb2, inverter_pb2
|
|
11
|
-
|
|
12
|
-
from .id import ComponentId
|
|
11
|
+
from frequenz.client.common.microgrid.components import ComponentId
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
class ComponentType(Enum):
|
|
@@ -9,6 +9,7 @@ from datetime import datetime, timezone
|
|
|
9
9
|
from typing import Self
|
|
10
10
|
|
|
11
11
|
from frequenz.api.microgrid import microgrid_pb2
|
|
12
|
+
from frequenz.client.common.microgrid.components import ComponentId
|
|
12
13
|
|
|
13
14
|
from ._component_error import BatteryError, InverterError
|
|
14
15
|
from ._component_states import (
|
|
@@ -18,7 +19,6 @@ from ._component_states import (
|
|
|
18
19
|
EVChargerComponentState,
|
|
19
20
|
InverterComponentState,
|
|
20
21
|
)
|
|
21
|
-
from .id import ComponentId
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
@dataclass(frozen=True)
|
|
@@ -10,10 +10,10 @@ from datetime import datetime
|
|
|
10
10
|
from frequenz.api.common import components_pb2
|
|
11
11
|
from frequenz.api.microgrid import common_pb2, microgrid_pb2, sensor_pb2
|
|
12
12
|
from frequenz.client.base import conversion
|
|
13
|
+
from frequenz.client.common.microgrid.sensors import SensorId
|
|
13
14
|
|
|
14
15
|
from ._lifetime import Lifetime
|
|
15
16
|
from ._util import enum_from_proto
|
|
16
|
-
from .id import SensorId
|
|
17
17
|
from .sensor import (
|
|
18
18
|
Sensor,
|
|
19
19
|
SensorDataSamples,
|
|
@@ -36,9 +36,9 @@ from datetime import datetime
|
|
|
36
36
|
from typing import assert_never
|
|
37
37
|
|
|
38
38
|
from frequenz.api.microgrid import sensor_pb2
|
|
39
|
+
from frequenz.client.common.microgrid.sensors import SensorId
|
|
39
40
|
|
|
40
41
|
from ._lifetime import Lifetime
|
|
41
|
-
from .id import SensorId
|
|
42
42
|
from .metrics import AggregatedMetricValue, AggregationMethod
|
|
43
43
|
|
|
44
44
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: frequenz-client-microgrid
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.0
|
|
4
4
|
Summary: Microgrid API client for Python
|
|
5
5
|
Author-email: Frequenz Energy-as-a-Service GmbH <floss@frequenz.com>
|
|
6
6
|
License: MIT
|
|
@@ -21,13 +21,14 @@ Classifier: Typing :: Typed
|
|
|
21
21
|
Requires-Python: <4,>=3.11
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
License-File: LICENSE
|
|
24
|
-
Requires-Dist: frequenz-api-microgrid<0.16.0,>=0.15.
|
|
24
|
+
Requires-Dist: frequenz-api-microgrid<0.16.0,>=0.15.5
|
|
25
25
|
Requires-Dist: frequenz-channels<2.0.0,>=1.0.0-rc1
|
|
26
|
-
Requires-Dist: frequenz-client-base<0.
|
|
27
|
-
Requires-Dist:
|
|
28
|
-
Requires-Dist:
|
|
26
|
+
Requires-Dist: frequenz-client-base<0.12.0,>=0.8.0
|
|
27
|
+
Requires-Dist: frequenz-client-common<0.4.0,>=0.3.2
|
|
28
|
+
Requires-Dist: grpcio<2,>=1.63.0
|
|
29
|
+
Requires-Dist: protobuf<7,>=5.26.1
|
|
29
30
|
Requires-Dist: timezonefinder<7,>=6.2.0
|
|
30
|
-
Requires-Dist: typing-extensions<5,>=4.
|
|
31
|
+
Requires-Dist: typing-extensions<5,>=4.13.0
|
|
31
32
|
Provides-Extra: dev-flake8
|
|
32
33
|
Requires-Dist: flake8==7.2.0; extra == "dev-flake8"
|
|
33
34
|
Requires-Dist: flake8-docstrings==1.7.0; extra == "dev-flake8"
|
|
@@ -44,26 +45,26 @@ Requires-Dist: mike==2.1.3; extra == "dev-mkdocs"
|
|
|
44
45
|
Requires-Dist: mkdocs-gen-files==0.5.0; extra == "dev-mkdocs"
|
|
45
46
|
Requires-Dist: mkdocs-literate-nav==0.6.2; extra == "dev-mkdocs"
|
|
46
47
|
Requires-Dist: mkdocs-macros-plugin==1.3.7; extra == "dev-mkdocs"
|
|
47
|
-
Requires-Dist: mkdocs-material==9.6.
|
|
48
|
+
Requires-Dist: mkdocs-material==9.6.14; extra == "dev-mkdocs"
|
|
48
49
|
Requires-Dist: mkdocstrings[python]==0.29.1; extra == "dev-mkdocs"
|
|
49
|
-
Requires-Dist: mkdocstrings-python==1.16.
|
|
50
|
-
Requires-Dist: frequenz-repo-config[lib]==0.13.
|
|
50
|
+
Requires-Dist: mkdocstrings-python==1.16.11; extra == "dev-mkdocs"
|
|
51
|
+
Requires-Dist: frequenz-repo-config[lib]==0.13.4; extra == "dev-mkdocs"
|
|
51
52
|
Provides-Extra: dev-mypy
|
|
52
|
-
Requires-Dist: mypy==1.
|
|
53
|
+
Requires-Dist: mypy==1.16.0; extra == "dev-mypy"
|
|
53
54
|
Requires-Dist: grpc-stubs==1.53.0.6; extra == "dev-mypy"
|
|
54
55
|
Requires-Dist: types-Markdown==3.8.0.20250415; extra == "dev-mypy"
|
|
55
|
-
Requires-Dist: types-protobuf==
|
|
56
|
+
Requires-Dist: types-protobuf==6.30.2.20250516; extra == "dev-mypy"
|
|
56
57
|
Requires-Dist: frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]; extra == "dev-mypy"
|
|
57
58
|
Provides-Extra: dev-noxfile
|
|
58
59
|
Requires-Dist: nox==2025.5.1; extra == "dev-noxfile"
|
|
59
|
-
Requires-Dist: frequenz-repo-config[lib]==0.13.
|
|
60
|
+
Requires-Dist: frequenz-repo-config[lib]==0.13.4; extra == "dev-noxfile"
|
|
60
61
|
Provides-Extra: dev-pylint
|
|
61
|
-
Requires-Dist: pylint==3.3.
|
|
62
|
+
Requires-Dist: pylint==3.3.7; extra == "dev-pylint"
|
|
62
63
|
Requires-Dist: frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]; extra == "dev-pylint"
|
|
63
64
|
Provides-Extra: dev-pytest
|
|
64
65
|
Requires-Dist: pytest==8.3.5; extra == "dev-pytest"
|
|
65
|
-
Requires-Dist: frequenz-repo-config[extra-lint-examples]==0.13.
|
|
66
|
-
Requires-Dist: pytest-mock==3.14.
|
|
66
|
+
Requires-Dist: frequenz-repo-config[extra-lint-examples]==0.13.4; extra == "dev-pytest"
|
|
67
|
+
Requires-Dist: pytest-mock==3.14.1; extra == "dev-pytest"
|
|
67
68
|
Requires-Dist: pytest-asyncio==0.26.0; extra == "dev-pytest"
|
|
68
69
|
Requires-Dist: async-solipsism==0.7; extra == "dev-pytest"
|
|
69
70
|
Provides-Extra: dev
|
|
@@ -17,7 +17,6 @@ src/frequenz/client/microgrid/_metadata.py
|
|
|
17
17
|
src/frequenz/client/microgrid/_sensor_proto.py
|
|
18
18
|
src/frequenz/client/microgrid/_util.py
|
|
19
19
|
src/frequenz/client/microgrid/conftest.py
|
|
20
|
-
src/frequenz/client/microgrid/id.py
|
|
21
20
|
src/frequenz/client/microgrid/metrics.py
|
|
22
21
|
src/frequenz/client/microgrid/py.typed
|
|
23
22
|
src/frequenz/client/microgrid/sensor.py
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
frequenz-api-microgrid<0.16.0,>=0.15.
|
|
1
|
+
frequenz-api-microgrid<0.16.0,>=0.15.5
|
|
2
2
|
frequenz-channels<2.0.0,>=1.0.0-rc1
|
|
3
|
-
frequenz-client-base<0.
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
frequenz-client-base<0.12.0,>=0.8.0
|
|
4
|
+
frequenz-client-common<0.4.0,>=0.3.2
|
|
5
|
+
grpcio<2,>=1.63.0
|
|
6
|
+
protobuf<7,>=5.26.1
|
|
6
7
|
timezonefinder<7,>=6.2.0
|
|
7
|
-
typing-extensions<5,>=4.
|
|
8
|
+
typing-extensions<5,>=4.13.0
|
|
8
9
|
|
|
9
10
|
[dev]
|
|
10
11
|
frequenz-client-microgrid[dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]
|
|
@@ -27,29 +28,29 @@ mike==2.1.3
|
|
|
27
28
|
mkdocs-gen-files==0.5.0
|
|
28
29
|
mkdocs-literate-nav==0.6.2
|
|
29
30
|
mkdocs-macros-plugin==1.3.7
|
|
30
|
-
mkdocs-material==9.6.
|
|
31
|
+
mkdocs-material==9.6.14
|
|
31
32
|
mkdocstrings[python]==0.29.1
|
|
32
|
-
mkdocstrings-python==1.16.
|
|
33
|
-
frequenz-repo-config[lib]==0.13.
|
|
33
|
+
mkdocstrings-python==1.16.11
|
|
34
|
+
frequenz-repo-config[lib]==0.13.4
|
|
34
35
|
|
|
35
36
|
[dev-mypy]
|
|
36
|
-
mypy==1.
|
|
37
|
+
mypy==1.16.0
|
|
37
38
|
grpc-stubs==1.53.0.6
|
|
38
39
|
types-Markdown==3.8.0.20250415
|
|
39
|
-
types-protobuf==
|
|
40
|
+
types-protobuf==6.30.2.20250516
|
|
40
41
|
frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]
|
|
41
42
|
|
|
42
43
|
[dev-noxfile]
|
|
43
44
|
nox==2025.5.1
|
|
44
|
-
frequenz-repo-config[lib]==0.13.
|
|
45
|
+
frequenz-repo-config[lib]==0.13.4
|
|
45
46
|
|
|
46
47
|
[dev-pylint]
|
|
47
|
-
pylint==3.3.
|
|
48
|
+
pylint==3.3.7
|
|
48
49
|
frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]
|
|
49
50
|
|
|
50
51
|
[dev-pytest]
|
|
51
52
|
pytest==8.3.5
|
|
52
|
-
frequenz-repo-config[extra-lint-examples]==0.13.
|
|
53
|
-
pytest-mock==3.14.
|
|
53
|
+
frequenz-repo-config[extra-lint-examples]==0.13.4
|
|
54
|
+
pytest-mock==3.14.1
|
|
54
55
|
pytest-asyncio==0.26.0
|
|
55
56
|
async-solipsism==0.7
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# Frequenz Microgrid API Client Release Notes
|
|
2
|
-
|
|
3
|
-
## Summary
|
|
4
|
-
|
|
5
|
-
This release introduces sensors support and adds official support for Python 3.12. It also includes some bug fixes.
|
|
6
|
-
|
|
7
|
-
## Upgrading
|
|
8
|
-
|
|
9
|
-
- Some minimum versions of dependencies have been bumped to support Python 3.12. You might also need to bump these dependencies in your project.
|
|
10
|
-
|
|
11
|
-
## New Features
|
|
12
|
-
|
|
13
|
-
- The `MicrogridApiClient` can now list sensor retrieving their metadata (`list_sensors()`) and can stream sensor data (`stream_sensor_data()`).
|
|
14
|
-
|
|
15
|
-
## Bug Fixes
|
|
16
|
-
|
|
17
|
-
- When retrieving the microgrid metadata using `metadata()`, if the location was empty in the protobuf message, a wrong location with long=0, lat=0 was used. Now the location will be properly set to `None` in that case.
|
|
18
|
-
- The client now does some missing cleanup (stopping background tasks) when disconnecting (and when used as a context manager).
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
# License: MIT
|
|
2
|
-
# Copyright © 2025 Frequenz Energy-as-a-Service GmbH
|
|
3
|
-
|
|
4
|
-
r'''Provides strongly-typed unique identifiers for entities.
|
|
5
|
-
|
|
6
|
-
This module offers a base class,
|
|
7
|
-
[`BaseId`][frequenz.client.microgrid.id.BaseId], which can be subclassed to
|
|
8
|
-
create distinct ID types for different components or concepts within a system.
|
|
9
|
-
These IDs ensure type safety, meaning that an ID for one type of entity (e.g., a
|
|
10
|
-
sensor) cannot be mistakenly used where an ID for another type (e.g., a
|
|
11
|
-
microgrid) is expected.
|
|
12
|
-
|
|
13
|
-
# Creating Custom ID Types
|
|
14
|
-
|
|
15
|
-
To define a new ID type, create a class that inherits from
|
|
16
|
-
[`BaseId`][frequenz.client.microgrid.id.BaseId] and provide a unique
|
|
17
|
-
`str_prefix` as a keyword argument in the class definition. This prefix is used
|
|
18
|
-
in the string representation of the ID and must be unique across all ID types.
|
|
19
|
-
|
|
20
|
-
Note:
|
|
21
|
-
The `str_prefix` must be unique across all ID types. If you try to use a
|
|
22
|
-
prefix that is already registered, a `ValueError` will be raised when defining
|
|
23
|
-
the class.
|
|
24
|
-
|
|
25
|
-
To encourage consistency, the class name must end with the suffix "Id" (e.g.,
|
|
26
|
-
`MyNewId`). This check can be bypassed by passing `allow_custom_name=True` when
|
|
27
|
-
defining the class (e.g., `class MyCustomName(BaseId, str_prefix="MCN",
|
|
28
|
-
allow_custom_name=True):`).
|
|
29
|
-
|
|
30
|
-
Tip:
|
|
31
|
-
Use the [`@typing.final`][typing.final] decorator to prevent subclassing of
|
|
32
|
-
ID classes.
|
|
33
|
-
|
|
34
|
-
Example: Creating a standard ID type
|
|
35
|
-
```python
|
|
36
|
-
from typing import final
|
|
37
|
-
from frequenz.client.microgrid.id import BaseId
|
|
38
|
-
|
|
39
|
-
@final
|
|
40
|
-
class InverterId(BaseId, str_prefix="INV"):
|
|
41
|
-
"""A unique identifier for an inverter."""
|
|
42
|
-
|
|
43
|
-
inv_id = InverterId(123)
|
|
44
|
-
print(inv_id) # Output: INV123
|
|
45
|
-
print(int(inv_id)) # Output: 123
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Example: Creating an ID type with a non-standard name
|
|
49
|
-
```python
|
|
50
|
-
from typing import final
|
|
51
|
-
from frequenz.client.microgrid.id import BaseId
|
|
52
|
-
|
|
53
|
-
@final
|
|
54
|
-
class CustomNameForId(BaseId, str_prefix="CST", allow_custom_name=True):
|
|
55
|
-
"""An ID with a custom name, not ending in 'Id'."""
|
|
56
|
-
|
|
57
|
-
custom_id = CustomNameForId(456)
|
|
58
|
-
print(custom_id) # Output: CST456
|
|
59
|
-
print(int(custom_id)) # Output: 456
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
# Predefined ID Types
|
|
63
|
-
|
|
64
|
-
This module predefines the following ID types:
|
|
65
|
-
|
|
66
|
-
- [`ComponentId`][frequenz.client.microgrid.id.ComponentId]: For identifying
|
|
67
|
-
generic components.
|
|
68
|
-
- [`MicrogridId`][frequenz.client.microgrid.id.MicrogridId]: For identifying
|
|
69
|
-
microgrids.
|
|
70
|
-
- [`SensorId`][frequenz.client.microgrid.id.SensorId]: For identifying sensors.
|
|
71
|
-
'''
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
from typing import Any, ClassVar, Self, cast, final
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
class BaseId:
|
|
78
|
-
"""A base class for unique identifiers.
|
|
79
|
-
|
|
80
|
-
Subclasses must provide a unique `str_prefix` keyword argument during
|
|
81
|
-
definition, which is used in the string representation of the ID.
|
|
82
|
-
|
|
83
|
-
By default, subclass names must end with "Id". This can be overridden by
|
|
84
|
-
passing `allow_custom_name=True` during class definition.
|
|
85
|
-
|
|
86
|
-
For more information and examples, see the [module's
|
|
87
|
-
documentation][frequenz.client.microgrid.id].
|
|
88
|
-
"""
|
|
89
|
-
|
|
90
|
-
_id: int
|
|
91
|
-
_str_prefix: ClassVar[str]
|
|
92
|
-
_registered_prefixes: ClassVar[set[str]] = set()
|
|
93
|
-
|
|
94
|
-
def __new__(cls, *_: Any, **__: Any) -> Self:
|
|
95
|
-
"""Create a new instance of the ID class, only if it is a subclass of BaseId."""
|
|
96
|
-
if cls is BaseId:
|
|
97
|
-
raise TypeError("BaseId cannot be instantiated directly. Use a subclass.")
|
|
98
|
-
return super().__new__(cls)
|
|
99
|
-
|
|
100
|
-
def __init_subclass__(
|
|
101
|
-
cls,
|
|
102
|
-
*,
|
|
103
|
-
str_prefix: str,
|
|
104
|
-
allow_custom_name: bool = False,
|
|
105
|
-
**kwargs: Any,
|
|
106
|
-
) -> None:
|
|
107
|
-
"""Initialize a subclass, set its string prefix, and perform checks.
|
|
108
|
-
|
|
109
|
-
Args:
|
|
110
|
-
str_prefix: The string prefix for the ID type (e.g., "MID").
|
|
111
|
-
Must be unique across all ID types.
|
|
112
|
-
allow_custom_name: If True, bypasses the check that the class name
|
|
113
|
-
must end with "Id". Defaults to False.
|
|
114
|
-
**kwargs: Forwarded to the parent's __init_subclass__.
|
|
115
|
-
|
|
116
|
-
Raises:
|
|
117
|
-
ValueError: If the `str_prefix` is already registered by another
|
|
118
|
-
ID type.
|
|
119
|
-
TypeError: If `allow_custom_name` is False and the class name
|
|
120
|
-
does not end with "Id".
|
|
121
|
-
"""
|
|
122
|
-
super().__init_subclass__(**kwargs)
|
|
123
|
-
|
|
124
|
-
if str_prefix in BaseId._registered_prefixes:
|
|
125
|
-
raise ValueError(
|
|
126
|
-
f"Prefix '{str_prefix}' is already registered. "
|
|
127
|
-
"ID prefixes must be unique."
|
|
128
|
-
)
|
|
129
|
-
BaseId._registered_prefixes.add(str_prefix)
|
|
130
|
-
|
|
131
|
-
if not allow_custom_name and not cls.__name__.endswith("Id"):
|
|
132
|
-
raise TypeError(
|
|
133
|
-
f"Class name '{cls.__name__}' for an ID class must end with 'Id' "
|
|
134
|
-
"(e.g., 'SomeId'), or use `allow_custom_name=True`."
|
|
135
|
-
)
|
|
136
|
-
|
|
137
|
-
cls._str_prefix = str_prefix
|
|
138
|
-
|
|
139
|
-
def __init__(self, id_: int, /) -> None:
|
|
140
|
-
"""Initialize this instance.
|
|
141
|
-
|
|
142
|
-
Args:
|
|
143
|
-
id_: The numeric unique identifier.
|
|
144
|
-
|
|
145
|
-
Raises:
|
|
146
|
-
ValueError: If the ID is negative.
|
|
147
|
-
"""
|
|
148
|
-
if id_ < 0:
|
|
149
|
-
raise ValueError(f"{type(self).__name__} can't be negative.")
|
|
150
|
-
self._id = id_
|
|
151
|
-
|
|
152
|
-
@property
|
|
153
|
-
def str_prefix(self) -> str:
|
|
154
|
-
"""The prefix used for the string representation of this ID."""
|
|
155
|
-
return self._str_prefix
|
|
156
|
-
|
|
157
|
-
def __int__(self) -> int:
|
|
158
|
-
"""Return the numeric ID of this instance."""
|
|
159
|
-
return self._id
|
|
160
|
-
|
|
161
|
-
def __eq__(self, other: object) -> bool:
|
|
162
|
-
"""Check if this instance is equal to another object.
|
|
163
|
-
|
|
164
|
-
Equality is defined as being of the exact same type and having the same
|
|
165
|
-
underlying ID.
|
|
166
|
-
"""
|
|
167
|
-
# pylint thinks this is not an unidiomatic typecheck, but in this case
|
|
168
|
-
# it is not. isinstance() returns True for subclasses, which is not
|
|
169
|
-
# what we want here, as different ID types should never be equal.
|
|
170
|
-
# pylint: disable-next=unidiomatic-typecheck
|
|
171
|
-
if type(other) is not type(self):
|
|
172
|
-
return NotImplemented
|
|
173
|
-
# We already checked type(other) is type(self), but mypy doesn't
|
|
174
|
-
# understand that, so we need to cast it to Self.
|
|
175
|
-
other_id = cast(Self, other)
|
|
176
|
-
return self._id == other_id._id
|
|
177
|
-
|
|
178
|
-
def __lt__(self, other: object) -> bool:
|
|
179
|
-
"""Check if this instance is less than another object.
|
|
180
|
-
|
|
181
|
-
Comparison is only defined between instances of the exact same type.
|
|
182
|
-
"""
|
|
183
|
-
# pylint: disable-next=unidiomatic-typecheck
|
|
184
|
-
if type(other) is not type(self):
|
|
185
|
-
return NotImplemented
|
|
186
|
-
other_id = cast(Self, other)
|
|
187
|
-
return self._id < other_id._id
|
|
188
|
-
|
|
189
|
-
def __hash__(self) -> int:
|
|
190
|
-
"""Return the hash of this instance.
|
|
191
|
-
|
|
192
|
-
The hash is based on the exact type and the underlying ID to ensure
|
|
193
|
-
that IDs of different types but with the same numeric value have different hashes.
|
|
194
|
-
"""
|
|
195
|
-
return hash((type(self), self._id))
|
|
196
|
-
|
|
197
|
-
def __repr__(self) -> str:
|
|
198
|
-
"""Return the string representation of this instance."""
|
|
199
|
-
return f"{type(self).__name__}({self._id!r})"
|
|
200
|
-
|
|
201
|
-
def __str__(self) -> str:
|
|
202
|
-
"""Return the short string representation of this instance."""
|
|
203
|
-
return f"{type(self)._str_prefix}{self._id}"
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
@final
|
|
207
|
-
class MicrogridId(BaseId, str_prefix="MID"):
|
|
208
|
-
"""A unique identifier for a microgrid."""
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
@final
|
|
212
|
-
class ComponentId(BaseId, str_prefix="CID"):
|
|
213
|
-
"""A unique identifier for a microgrid component."""
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
@final
|
|
217
|
-
class SensorId(BaseId, str_prefix="SID"):
|
|
218
|
-
"""A unique identifier for a microgrid sensor."""
|
|
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
|