frequenz-client-common 0.3.0__tar.gz → 0.3.3__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.
Files changed (24) hide show
  1. {frequenz_client_common-0.3.0/src/frequenz_client_common.egg-info → frequenz_client_common-0.3.3}/PKG-INFO +25 -23
  2. frequenz_client_common-0.3.3/RELEASE_NOTES.md +22 -0
  3. {frequenz_client_common-0.3.0 → frequenz_client_common-0.3.3}/pyproject.toml +36 -26
  4. frequenz_client_common-0.3.3/src/frequenz/client/common/enum_proto.py +76 -0
  5. {frequenz_client_common-0.3.0 → frequenz_client_common-0.3.3}/src/frequenz/client/common/metric/__init__.py +5 -2
  6. frequenz_client_common-0.3.3/src/frequenz/client/common/microgrid/__init__.py +18 -0
  7. {frequenz_client_common-0.3.0 → frequenz_client_common-0.3.3}/src/frequenz/client/common/microgrid/components/__init__.py +65 -4
  8. frequenz_client_common-0.3.3/src/frequenz/client/common/microgrid/sensors.py +13 -0
  9. {frequenz_client_common-0.3.0 → frequenz_client_common-0.3.3/src/frequenz_client_common.egg-info}/PKG-INFO +25 -23
  10. {frequenz_client_common-0.3.0 → frequenz_client_common-0.3.3}/src/frequenz_client_common.egg-info/SOURCES.txt +2 -0
  11. frequenz_client_common-0.3.3/src/frequenz_client_common.egg-info/requires.txt +49 -0
  12. frequenz_client_common-0.3.0/RELEASE_NOTES.md +0 -19
  13. frequenz_client_common-0.3.0/src/frequenz/client/common/microgrid/__init__.py +0 -4
  14. frequenz_client_common-0.3.0/src/frequenz_client_common.egg-info/requires.txt +0 -48
  15. {frequenz_client_common-0.3.0 → frequenz_client_common-0.3.3}/LICENSE +0 -0
  16. {frequenz_client_common-0.3.0 → frequenz_client_common-0.3.3}/MANIFEST.in +0 -0
  17. {frequenz_client_common-0.3.0 → frequenz_client_common-0.3.3}/README.md +0 -0
  18. {frequenz_client_common-0.3.0 → frequenz_client_common-0.3.3}/setup.cfg +0 -0
  19. {frequenz_client_common-0.3.0 → frequenz_client_common-0.3.3}/src/frequenz/client/common/__init__.py +0 -0
  20. {frequenz_client_common-0.3.0 → frequenz_client_common-0.3.3}/src/frequenz/client/common/conftest.py +0 -0
  21. {frequenz_client_common-0.3.0 → frequenz_client_common-0.3.3}/src/frequenz/client/common/pagination/__init__.py +0 -0
  22. {frequenz_client_common-0.3.0 → frequenz_client_common-0.3.3}/src/frequenz/client/common/py.typed +0 -0
  23. {frequenz_client_common-0.3.0 → frequenz_client_common-0.3.3}/src/frequenz_client_common.egg-info/dependency_links.txt +0 -0
  24. {frequenz_client_common-0.3.0 → frequenz_client_common-0.3.3}/src/frequenz_client_common.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: frequenz-client-common
3
- Version: 0.3.0
3
+ Version: 0.3.3
4
4
  Summary: Common code and utilities for Frequenz API clients
5
5
  Author-email: Frequenz Energy-as-a-Service GmbH <floss@frequenz.com>
6
6
  License: MIT
@@ -20,46 +20,48 @@ Classifier: Typing :: Typed
20
20
  Requires-Python: <4,>=3.11
21
21
  Description-Content-Type: text/markdown
22
22
  License-File: LICENSE
23
- Requires-Dist: typing-extensions<5,>=4.5.0
24
- Requires-Dist: frequenz-api-common<7,>=0.6.0
23
+ Requires-Dist: typing-extensions<5,>=4.13.0
24
+ Requires-Dist: frequenz-api-common<7,>=0.6.1
25
+ Requires-Dist: frequenz-core<2,>=1.0.2
25
26
  Provides-Extra: dev-flake8
26
- Requires-Dist: flake8==7.1.1; extra == "dev-flake8"
27
+ Requires-Dist: flake8==7.2.0; extra == "dev-flake8"
27
28
  Requires-Dist: flake8-docstrings==1.7.0; extra == "dev-flake8"
28
29
  Requires-Dist: flake8-pyproject==1.2.3; extra == "dev-flake8"
29
- Requires-Dist: pydoclint==0.5.9; extra == "dev-flake8"
30
+ Requires-Dist: pydoclint==0.6.6; extra == "dev-flake8"
30
31
  Requires-Dist: pydocstyle==6.3.0; extra == "dev-flake8"
31
32
  Provides-Extra: dev-formatting
32
- Requires-Dist: black==24.10.0; extra == "dev-formatting"
33
- Requires-Dist: isort==5.13.2; extra == "dev-formatting"
33
+ Requires-Dist: black==25.1.0; extra == "dev-formatting"
34
+ Requires-Dist: isort==6.0.1; extra == "dev-formatting"
34
35
  Provides-Extra: dev-mkdocs
35
- Requires-Dist: black==24.10.0; extra == "dev-mkdocs"
36
- Requires-Dist: Markdown==3.7; extra == "dev-mkdocs"
36
+ Requires-Dist: Markdown==3.8; extra == "dev-mkdocs"
37
+ Requires-Dist: black==25.1.0; extra == "dev-mkdocs"
37
38
  Requires-Dist: mike==2.1.3; extra == "dev-mkdocs"
38
39
  Requires-Dist: mkdocs-gen-files==0.5.0; extra == "dev-mkdocs"
39
- Requires-Dist: mkdocs-literate-nav==0.6.1; extra == "dev-mkdocs"
40
+ Requires-Dist: mkdocs-literate-nav==0.6.2; extra == "dev-mkdocs"
40
41
  Requires-Dist: mkdocs-macros-plugin==1.3.7; extra == "dev-mkdocs"
41
- Requires-Dist: mkdocs-material==9.5.47; extra == "dev-mkdocs"
42
- Requires-Dist: mkdocstrings[python]==0.27.0; extra == "dev-mkdocs"
43
- Requires-Dist: mkdocstrings-python==1.12.2; extra == "dev-mkdocs"
44
- Requires-Dist: frequenz-repo-config[lib]==0.11.0; extra == "dev-mkdocs"
42
+ Requires-Dist: mkdocs-material==9.6.12; extra == "dev-mkdocs"
43
+ Requires-Dist: mkdocstrings[python]==0.29.1; extra == "dev-mkdocs"
44
+ Requires-Dist: mkdocstrings-python==1.16.10; extra == "dev-mkdocs"
45
+ Requires-Dist: frequenz-repo-config[lib]==0.13.3; extra == "dev-mkdocs"
45
46
  Provides-Extra: dev-mypy
46
- Requires-Dist: mypy==1.13.0; extra == "dev-mypy"
47
- Requires-Dist: types-Markdown==3.7.0.20241204; extra == "dev-mypy"
47
+ Requires-Dist: mypy==1.15.0; extra == "dev-mypy"
48
+ Requires-Dist: types-Markdown==3.8.0.20250415; extra == "dev-mypy"
48
49
  Requires-Dist: frequenz-client-common[dev-mkdocs,dev-noxfile,dev-pytest]; extra == "dev-mypy"
49
50
  Provides-Extra: dev-noxfile
50
- Requires-Dist: nox==2024.10.9; extra == "dev-noxfile"
51
- Requires-Dist: frequenz-repo-config[lib]==0.11.0; extra == "dev-noxfile"
51
+ Requires-Dist: nox==2025.5.1; extra == "dev-noxfile"
52
+ Requires-Dist: frequenz-repo-config[lib]==0.13.3; extra == "dev-noxfile"
52
53
  Provides-Extra: dev-pylint
53
- Requires-Dist: pylint==3.3.2; extra == "dev-pylint"
54
+ Requires-Dist: pylint==3.3.6; extra == "dev-pylint"
54
55
  Requires-Dist: frequenz-client-common[dev-mkdocs,dev-noxfile,dev-pytest]; extra == "dev-pylint"
55
56
  Provides-Extra: dev-pytest
56
- Requires-Dist: pytest==8.3.4; extra == "dev-pytest"
57
- Requires-Dist: frequenz-repo-config[extra-lint-examples]==0.11.0; extra == "dev-pytest"
57
+ Requires-Dist: pytest==8.3.5; extra == "dev-pytest"
58
+ Requires-Dist: frequenz-repo-config[extra-lint-examples]==0.13.3; extra == "dev-pytest"
58
59
  Requires-Dist: pytest-mock==3.14.0; extra == "dev-pytest"
59
- Requires-Dist: pytest-asyncio==0.24.0; extra == "dev-pytest"
60
+ Requires-Dist: pytest-asyncio==0.26.0; extra == "dev-pytest"
60
61
  Requires-Dist: async-solipsism==0.7; extra == "dev-pytest"
61
62
  Provides-Extra: dev
62
63
  Requires-Dist: frequenz-client-common[dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]; extra == "dev"
64
+ Dynamic: license-file
63
65
 
64
66
  # Frequenz Client Common Library
65
67
 
@@ -0,0 +1,22 @@
1
+ # Frequenz Client Common Library Release Notes
2
+
3
+ ## Summary
4
+
5
+ <!-- Here goes a general summary of what this release is about -->
6
+
7
+ ## Upgrading
8
+
9
+ - The metrics and components enums `.from_proto()` are deprecated, please use the new `enum_from_proto()` instead.
10
+ - Some minimum dependencies have been bumped, you might need to update your minimum dependencies too:
11
+
12
+ * `frequenz-api-common` to 0.6.1
13
+ * `frequenz-core` to 1.0.2
14
+
15
+ ## New Features
16
+
17
+ - A new module `frequenz.client.common.enum_proto` has been added, which provides a generic `enum_from_proto()` function to convert protobuf enums to Python enums.
18
+ - The `frequenz.client.common.microgrid.ComponentCategory` was extended to include the missing categories.
19
+
20
+ ## Bug Fixes
21
+
22
+ <!-- Here goes notable bug fixes that are worth a special mention or explanation -->
@@ -3,9 +3,9 @@
3
3
 
4
4
  [build-system]
5
5
  requires = [
6
- "setuptools == 75.6.0",
7
- "setuptools_scm[toml] == 8.1.0",
8
- "frequenz-repo-config[lib] == 0.11.0",
6
+ "setuptools == 80.3.1",
7
+ "setuptools_scm[toml] == 8.3.1",
8
+ "frequenz-repo-config[lib] == 0.13.3",
9
9
  ]
10
10
  build-backend = "setuptools.build_meta"
11
11
 
@@ -26,8 +26,9 @@ classifiers = [
26
26
  ]
27
27
  requires-python = ">= 3.11, < 4"
28
28
  dependencies = [
29
- "typing-extensions >= 4.5.0, < 5",
30
- "frequenz-api-common >= 0.6.0, < 7",
29
+ "typing-extensions >= 4.13.0, < 5",
30
+ "frequenz-api-common >= 0.6.1, < 7",
31
+ "frequenz-core >= 1.0.2, < 2",
31
32
  ]
32
33
  dynamic = ["version"]
33
34
 
@@ -37,45 +38,42 @@ email = "floss@frequenz.com"
37
38
 
38
39
  [project.optional-dependencies]
39
40
  dev-flake8 = [
40
- "flake8 == 7.1.1",
41
+ "flake8 == 7.2.0",
41
42
  "flake8-docstrings == 1.7.0",
42
- "flake8-pyproject == 1.2.3", # For reading the flake8 config from pyproject.toml
43
- "pydoclint == 0.5.9",
43
+ "flake8-pyproject == 1.2.3", # For reading the flake8 config from pyproject.toml
44
+ "pydoclint == 0.6.6",
44
45
  "pydocstyle == 6.3.0",
45
46
  ]
46
- dev-formatting = ["black == 24.10.0", "isort == 5.13.2"]
47
+ dev-formatting = ["black == 25.1.0", "isort == 6.0.1"]
47
48
  dev-mkdocs = [
48
- "black == 24.10.0",
49
- "Markdown==3.7",
49
+ "Markdown == 3.8",
50
+ "black == 25.1.0",
50
51
  "mike == 2.1.3",
51
52
  "mkdocs-gen-files == 0.5.0",
52
- "mkdocs-literate-nav == 0.6.1",
53
+ "mkdocs-literate-nav == 0.6.2",
53
54
  "mkdocs-macros-plugin == 1.3.7",
54
- "mkdocs-material == 9.5.47",
55
- "mkdocstrings[python] == 0.27.0",
56
- "mkdocstrings-python == 1.12.2",
57
- "frequenz-repo-config[lib] == 0.11.0",
55
+ "mkdocs-material == 9.6.12",
56
+ "mkdocstrings[python] == 0.29.1",
57
+ "mkdocstrings-python == 1.16.10",
58
+ "frequenz-repo-config[lib] == 0.13.3",
58
59
  ]
59
60
  dev-mypy = [
60
- "mypy == 1.13.0",
61
- "types-Markdown == 3.7.0.20241204",
61
+ "mypy == 1.15.0",
62
+ "types-Markdown == 3.8.0.20250415",
62
63
  # For checking the noxfile, docs/ script, and tests
63
64
  "frequenz-client-common[dev-mkdocs,dev-noxfile,dev-pytest]",
64
65
  ]
65
- dev-noxfile = [
66
- "nox == 2024.10.9",
67
- "frequenz-repo-config[lib] == 0.11.0",
68
- ]
66
+ dev-noxfile = ["nox == 2025.5.1", "frequenz-repo-config[lib] == 0.13.3"]
69
67
  dev-pylint = [
70
- "pylint == 3.3.2",
68
+ "pylint == 3.3.6",
71
69
  # For checking the noxfile, docs/ script, and tests
72
70
  "frequenz-client-common[dev-mkdocs,dev-noxfile,dev-pytest]",
73
71
  ]
74
72
  dev-pytest = [
75
- "pytest == 8.3.4",
76
- "frequenz-repo-config[extra-lint-examples] == 0.11.0",
73
+ "pytest == 8.3.5",
74
+ "frequenz-repo-config[extra-lint-examples] == 0.13.3",
77
75
  "pytest-mock == 3.14.0",
78
- "pytest-asyncio == 0.24.0",
76
+ "pytest-asyncio == 0.26.0",
79
77
  "async-solipsism == 0.7",
80
78
  ]
81
79
  dev = [
@@ -147,6 +145,18 @@ disable = [
147
145
  ]
148
146
 
149
147
  [tool.pytest.ini_options]
148
+ addopts = "-vv"
149
+ filterwarnings = [
150
+ "error",
151
+ "once::DeprecationWarning",
152
+ "once::PendingDeprecationWarning",
153
+ # We ignore warnings about protobuf gencode version being one version older
154
+ # than the current version, as this is supported by protobuf, and we expect to
155
+ # have such cases. If we go too far, we will get a proper error anyways.
156
+ # We use a raw string (single quotes) to avoid the need to escape special
157
+ # characters as this is a regex.
158
+ 'ignore:Protobuf gencode version .*exactly one major version older.*:UserWarning',
159
+ ]
150
160
  testpaths = ["tests", "src"]
151
161
  asyncio_mode = "auto"
152
162
  asyncio_default_fixture_loop_scope = "function"
@@ -0,0 +1,76 @@
1
+ # License: MIT
2
+ # Copyright © 2025 Frequenz Energy-as-a-Service GmbH
3
+
4
+ """Conversion of protobuf int enums to Python enums."""
5
+
6
+ import enum
7
+ from typing import Literal, TypeVar, overload
8
+
9
+ EnumT = TypeVar("EnumT", bound=enum.Enum)
10
+ """A type variable that is bound to an enum."""
11
+
12
+
13
+ @overload
14
+ def enum_from_proto(
15
+ value: int, enum_type: type[EnumT], *, allow_invalid: Literal[False]
16
+ ) -> EnumT: ...
17
+
18
+
19
+ @overload
20
+ def enum_from_proto(
21
+ value: int, enum_type: type[EnumT], *, allow_invalid: Literal[True] = True
22
+ ) -> EnumT | int: ...
23
+
24
+
25
+ def enum_from_proto(
26
+ value: int, enum_type: type[EnumT], *, allow_invalid: bool = True
27
+ ) -> EnumT | int:
28
+ """Convert a protobuf int enum value to a python enum.
29
+
30
+ Example:
31
+ ```python
32
+ import enum
33
+
34
+ from proto import proto_pb2 # Just an example. pylint: disable=import-error
35
+
36
+ @enum.unique
37
+ class SomeEnum(enum.Enum):
38
+ # These values should match the protobuf enum values.
39
+ UNSPECIFIED = 0
40
+ SOME_VALUE = 1
41
+
42
+ enum_value = enum_from_proto(proto_pb2.SomeEnum.SOME_ENUM_SOME_VALUE, SomeEnum)
43
+ # -> SomeEnum.SOME_VALUE
44
+
45
+ enum_value = enum_from_proto(42, SomeEnum)
46
+ # -> 42
47
+
48
+ enum_value = enum_from_proto(
49
+ proto_pb2.SomeEnum.SOME_ENUM_UNKNOWN_VALUE, SomeEnum, allow_invalid=False
50
+ )
51
+ # -> ValueError
52
+ ```
53
+
54
+ Args:
55
+ value: The protobuf int enum value.
56
+ enum_type: The python enum type to convert to.
57
+ allow_invalid: If `True`, return the value as an `int` if the value is not
58
+ a valid member of the enum (this allows for forward-compatibility with new
59
+ enum values defined in the protocol but not added to the Python enum yet).
60
+ If `False`, raise a `ValueError` if the value is not a valid member of the
61
+ enum.
62
+
63
+ Returns:
64
+ The resulting python enum value if the protobuf value is known, otherwise
65
+ the input value converted to a plain `int`.
66
+
67
+ Raises:
68
+ ValueError: If `allow_invalid` is `False` and the value is not a valid member
69
+ of the enum.
70
+ """
71
+ try:
72
+ return enum_type(value)
73
+ except ValueError:
74
+ if allow_invalid:
75
+ return value
76
+ raise
@@ -3,16 +3,18 @@
3
3
 
4
4
  """Module to define the metrics used with the common client."""
5
5
 
6
- from enum import Enum
6
+ import enum
7
7
  from typing import Self
8
8
 
9
9
  # pylint: disable=no-name-in-module
10
10
  from frequenz.api.common.v1.metrics.metric_sample_pb2 import Metric as PBMetric
11
+ from typing_extensions import deprecated
11
12
 
12
13
  # pylint: enable=no-name-in-module
13
14
 
14
15
 
15
- class Metric(Enum):
16
+ @enum.unique
17
+ class Metric(enum.Enum):
16
18
  """List of supported metrics.
17
19
 
18
20
  AC energy metrics information:
@@ -140,6 +142,7 @@ class Metric(Enum):
140
142
  SENSOR_IRRADIANCE = PBMetric.METRIC_SENSOR_IRRADIANCE
141
143
 
142
144
  @classmethod
145
+ @deprecated("Use `frequenz.client.common.enum_proto.enum_from_proto` instead.")
143
146
  def from_proto(cls, metric: PBMetric.ValueType) -> Self:
144
147
  """Convert a protobuf Metric value to Metric enum.
145
148
 
@@ -0,0 +1,18 @@
1
+ # License: MIT
2
+ # Copyright © 2023 Frequenz Energy-as-a-Service GmbH
3
+
4
+ """Frequenz microgrid definition."""
5
+
6
+ from typing import final
7
+
8
+ from frequenz.core.id import BaseId
9
+
10
+
11
+ @final
12
+ class EnterpriseId(BaseId, str_prefix="EID"):
13
+ """A unique identifier for an enterprise account."""
14
+
15
+
16
+ @final
17
+ class MicrogridId(BaseId, str_prefix="MID"):
18
+ """A unique identifier for a microgrid."""
@@ -2,9 +2,11 @@
2
2
  # Copyright © 2022 Frequenz Energy-as-a-Service GmbH
3
3
 
4
4
  """Defines the components that can be used in a microgrid."""
5
+
5
6
  from __future__ import annotations
6
7
 
7
- from enum import Enum
8
+ import enum
9
+ from typing import final
8
10
 
9
11
  # pylint: disable=no-name-in-module
10
12
  from frequenz.api.common.v1.microgrid.components.components_pb2 import (
@@ -16,11 +18,19 @@ from frequenz.api.common.v1.microgrid.components.components_pb2 import (
16
18
  from frequenz.api.common.v1.microgrid.components.components_pb2 import (
17
19
  ComponentStateCode as PBComponentStateCode,
18
20
  )
21
+ from frequenz.core.id import BaseId
22
+ from typing_extensions import deprecated
19
23
 
20
24
  # pylint: enable=no-name-in-module
21
25
 
22
26
 
23
- class ComponentCategory(Enum):
27
+ @final
28
+ class ComponentId(BaseId, str_prefix="CID"):
29
+ """A unique identifier for a microgrid component."""
30
+
31
+
32
+ @enum.unique
33
+ class ComponentCategory(enum.Enum):
24
34
  """Possible types of microgrid component."""
25
35
 
26
36
  UNSPECIFIED = PBComponentCategory.COMPONENT_CATEGORY_UNSPECIFIED
@@ -39,16 +49,63 @@ class ComponentCategory(Enum):
39
49
  INVERTER = PBComponentCategory.COMPONENT_CATEGORY_INVERTER
40
50
  """An electricity generator, with batteries or solar energy."""
41
51
 
52
+ CONVERTER = PBComponentCategory.COMPONENT_CATEGORY_CONVERTER
53
+ """A DC-DC converter."""
54
+
42
55
  BATTERY = PBComponentCategory.COMPONENT_CATEGORY_BATTERY
43
56
  """A storage system for electrical energy, used by inverters."""
44
57
 
45
58
  EV_CHARGER = PBComponentCategory.COMPONENT_CATEGORY_EV_CHARGER
46
59
  """A station for charging electrical vehicles."""
47
60
 
61
+ CRYPTO_MINER = PBComponentCategory.COMPONENT_CATEGORY_CRYPTO_MINER
62
+ """A crypto miner."""
63
+
64
+ ELECTROLYZER = PBComponentCategory.COMPONENT_CATEGORY_ELECTROLYZER
65
+ """An electrolyzer for converting water into hydrogen and oxygen."""
66
+
48
67
  CHP = PBComponentCategory.COMPONENT_CATEGORY_CHP
49
68
  """A heat and power combustion plant (CHP stands for combined heat and power)."""
50
69
 
70
+ RELAY = PBComponentCategory.COMPONENT_CATEGORY_RELAY
71
+ """A relay.
72
+
73
+ Relays generally have two states: open (connected) and closed (disconnected).
74
+ They are generally placed in front of a component, e.g., an inverter, to
75
+ control whether the component is connected to the grid or not.
76
+ """
77
+
78
+ PRECHARGER = PBComponentCategory.COMPONENT_CATEGORY_PRECHARGER
79
+ """A precharge module.
80
+
81
+ Precharging involves gradually ramping up the DC voltage to prevent any
82
+ potential damage to sensitive electrical components like capacitors.
83
+
84
+ While many inverters and batteries come equipped with in-built precharging
85
+ mechanisms, some may lack this feature. In such cases, we need to use
86
+ external precharging modules.
87
+ """
88
+
89
+ FUSE = PBComponentCategory.COMPONENT_CATEGORY_FUSE
90
+ """A fuse."""
91
+
92
+ VOLTAGE_TRANSFORMER = PBComponentCategory.COMPONENT_CATEGORY_VOLTAGE_TRANSFORMER
93
+ """A voltage transformer.
94
+
95
+ Voltage transformers are used to step up or step down the voltage, keeping
96
+ the power somewhat constant by increasing or decreasing the current. If voltage is
97
+ stepped up, current is stepped down, and vice versa.
98
+
99
+ Note:
100
+ Voltage transformers have efficiency losses, so the output power is
101
+ always less than the input power.
102
+ """
103
+
104
+ HVAC = PBComponentCategory.COMPONENT_CATEGORY_HVAC
105
+ """A Heating, Ventilation, and Air Conditioning (HVAC) system."""
106
+
51
107
  @classmethod
108
+ @deprecated("Use `frequenz.client.common.enum_proto.enum_from_proto` instead.")
52
109
  def from_proto(
53
110
  cls, component_category: PBComponentCategory.ValueType
54
111
  ) -> ComponentCategory:
@@ -73,7 +130,8 @@ class ComponentCategory(Enum):
73
130
  return self.value
74
131
 
75
132
 
76
- class ComponentStateCode(Enum):
133
+ @enum.unique
134
+ class ComponentStateCode(enum.Enum):
77
135
  """All possible states of a microgrid component."""
78
136
 
79
137
  UNSPECIFIED = PBComponentStateCode.COMPONENT_STATE_CODE_UNSPECIFIED
@@ -153,6 +211,7 @@ class ComponentStateCode(Enum):
153
211
  """The precharger circuit is closed, allowing full current to flow to the main circuit."""
154
212
 
155
213
  @classmethod
214
+ @deprecated("Use `frequenz.client.common.enum_proto.enum_from_proto` instead.")
156
215
  def from_proto(
157
216
  cls, component_state: PBComponentStateCode.ValueType
158
217
  ) -> ComponentStateCode:
@@ -177,7 +236,8 @@ class ComponentStateCode(Enum):
177
236
  return self.value
178
237
 
179
238
 
180
- class ComponentErrorCode(Enum):
239
+ @enum.unique
240
+ class ComponentErrorCode(enum.Enum):
181
241
  """All possible errors that can occur across all microgrid component categories."""
182
242
 
183
243
  UNSPECIFIED = PBComponentErrorCode.COMPONENT_ERROR_CODE_UNSPECIFIED
@@ -330,6 +390,7 @@ class ComponentErrorCode(Enum):
330
390
  times."""
331
391
 
332
392
  @classmethod
393
+ @deprecated("Use `frequenz.client.common.enum_proto.enum_from_proto` instead.")
333
394
  def from_proto(
334
395
  cls, component_error_code: PBComponentErrorCode.ValueType
335
396
  ) -> ComponentErrorCode:
@@ -0,0 +1,13 @@
1
+ # License: MIT
2
+ # Copyright © 2025 Frequenz Energy-as-a-Service GmbH
3
+
4
+ """Microgrid sensors."""
5
+
6
+ from typing import final
7
+
8
+ from frequenz.core.id import BaseId
9
+
10
+
11
+ @final
12
+ class SensorId(BaseId, str_prefix="SID"):
13
+ """A unique identifier for a microgrid sensor."""
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: frequenz-client-common
3
- Version: 0.3.0
3
+ Version: 0.3.3
4
4
  Summary: Common code and utilities for Frequenz API clients
5
5
  Author-email: Frequenz Energy-as-a-Service GmbH <floss@frequenz.com>
6
6
  License: MIT
@@ -20,46 +20,48 @@ Classifier: Typing :: Typed
20
20
  Requires-Python: <4,>=3.11
21
21
  Description-Content-Type: text/markdown
22
22
  License-File: LICENSE
23
- Requires-Dist: typing-extensions<5,>=4.5.0
24
- Requires-Dist: frequenz-api-common<7,>=0.6.0
23
+ Requires-Dist: typing-extensions<5,>=4.13.0
24
+ Requires-Dist: frequenz-api-common<7,>=0.6.1
25
+ Requires-Dist: frequenz-core<2,>=1.0.2
25
26
  Provides-Extra: dev-flake8
26
- Requires-Dist: flake8==7.1.1; extra == "dev-flake8"
27
+ Requires-Dist: flake8==7.2.0; extra == "dev-flake8"
27
28
  Requires-Dist: flake8-docstrings==1.7.0; extra == "dev-flake8"
28
29
  Requires-Dist: flake8-pyproject==1.2.3; extra == "dev-flake8"
29
- Requires-Dist: pydoclint==0.5.9; extra == "dev-flake8"
30
+ Requires-Dist: pydoclint==0.6.6; extra == "dev-flake8"
30
31
  Requires-Dist: pydocstyle==6.3.0; extra == "dev-flake8"
31
32
  Provides-Extra: dev-formatting
32
- Requires-Dist: black==24.10.0; extra == "dev-formatting"
33
- Requires-Dist: isort==5.13.2; extra == "dev-formatting"
33
+ Requires-Dist: black==25.1.0; extra == "dev-formatting"
34
+ Requires-Dist: isort==6.0.1; extra == "dev-formatting"
34
35
  Provides-Extra: dev-mkdocs
35
- Requires-Dist: black==24.10.0; extra == "dev-mkdocs"
36
- Requires-Dist: Markdown==3.7; extra == "dev-mkdocs"
36
+ Requires-Dist: Markdown==3.8; extra == "dev-mkdocs"
37
+ Requires-Dist: black==25.1.0; extra == "dev-mkdocs"
37
38
  Requires-Dist: mike==2.1.3; extra == "dev-mkdocs"
38
39
  Requires-Dist: mkdocs-gen-files==0.5.0; extra == "dev-mkdocs"
39
- Requires-Dist: mkdocs-literate-nav==0.6.1; extra == "dev-mkdocs"
40
+ Requires-Dist: mkdocs-literate-nav==0.6.2; extra == "dev-mkdocs"
40
41
  Requires-Dist: mkdocs-macros-plugin==1.3.7; extra == "dev-mkdocs"
41
- Requires-Dist: mkdocs-material==9.5.47; extra == "dev-mkdocs"
42
- Requires-Dist: mkdocstrings[python]==0.27.0; extra == "dev-mkdocs"
43
- Requires-Dist: mkdocstrings-python==1.12.2; extra == "dev-mkdocs"
44
- Requires-Dist: frequenz-repo-config[lib]==0.11.0; extra == "dev-mkdocs"
42
+ Requires-Dist: mkdocs-material==9.6.12; extra == "dev-mkdocs"
43
+ Requires-Dist: mkdocstrings[python]==0.29.1; extra == "dev-mkdocs"
44
+ Requires-Dist: mkdocstrings-python==1.16.10; extra == "dev-mkdocs"
45
+ Requires-Dist: frequenz-repo-config[lib]==0.13.3; extra == "dev-mkdocs"
45
46
  Provides-Extra: dev-mypy
46
- Requires-Dist: mypy==1.13.0; extra == "dev-mypy"
47
- Requires-Dist: types-Markdown==3.7.0.20241204; extra == "dev-mypy"
47
+ Requires-Dist: mypy==1.15.0; extra == "dev-mypy"
48
+ Requires-Dist: types-Markdown==3.8.0.20250415; extra == "dev-mypy"
48
49
  Requires-Dist: frequenz-client-common[dev-mkdocs,dev-noxfile,dev-pytest]; extra == "dev-mypy"
49
50
  Provides-Extra: dev-noxfile
50
- Requires-Dist: nox==2024.10.9; extra == "dev-noxfile"
51
- Requires-Dist: frequenz-repo-config[lib]==0.11.0; extra == "dev-noxfile"
51
+ Requires-Dist: nox==2025.5.1; extra == "dev-noxfile"
52
+ Requires-Dist: frequenz-repo-config[lib]==0.13.3; extra == "dev-noxfile"
52
53
  Provides-Extra: dev-pylint
53
- Requires-Dist: pylint==3.3.2; extra == "dev-pylint"
54
+ Requires-Dist: pylint==3.3.6; extra == "dev-pylint"
54
55
  Requires-Dist: frequenz-client-common[dev-mkdocs,dev-noxfile,dev-pytest]; extra == "dev-pylint"
55
56
  Provides-Extra: dev-pytest
56
- Requires-Dist: pytest==8.3.4; extra == "dev-pytest"
57
- Requires-Dist: frequenz-repo-config[extra-lint-examples]==0.11.0; extra == "dev-pytest"
57
+ Requires-Dist: pytest==8.3.5; extra == "dev-pytest"
58
+ Requires-Dist: frequenz-repo-config[extra-lint-examples]==0.13.3; extra == "dev-pytest"
58
59
  Requires-Dist: pytest-mock==3.14.0; extra == "dev-pytest"
59
- Requires-Dist: pytest-asyncio==0.24.0; extra == "dev-pytest"
60
+ Requires-Dist: pytest-asyncio==0.26.0; extra == "dev-pytest"
60
61
  Requires-Dist: async-solipsism==0.7; extra == "dev-pytest"
61
62
  Provides-Extra: dev
62
63
  Requires-Dist: frequenz-client-common[dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]; extra == "dev"
64
+ Dynamic: license-file
63
65
 
64
66
  # Frequenz Client Common Library
65
67
 
@@ -5,9 +5,11 @@ RELEASE_NOTES.md
5
5
  pyproject.toml
6
6
  src/frequenz/client/common/__init__.py
7
7
  src/frequenz/client/common/conftest.py
8
+ src/frequenz/client/common/enum_proto.py
8
9
  src/frequenz/client/common/py.typed
9
10
  src/frequenz/client/common/metric/__init__.py
10
11
  src/frequenz/client/common/microgrid/__init__.py
12
+ src/frequenz/client/common/microgrid/sensors.py
11
13
  src/frequenz/client/common/microgrid/components/__init__.py
12
14
  src/frequenz/client/common/pagination/__init__.py
13
15
  src/frequenz_client_common.egg-info/PKG-INFO
@@ -0,0 +1,49 @@
1
+ typing-extensions<5,>=4.13.0
2
+ frequenz-api-common<7,>=0.6.1
3
+ frequenz-core<2,>=1.0.2
4
+
5
+ [dev]
6
+ frequenz-client-common[dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]
7
+
8
+ [dev-flake8]
9
+ flake8==7.2.0
10
+ flake8-docstrings==1.7.0
11
+ flake8-pyproject==1.2.3
12
+ pydoclint==0.6.6
13
+ pydocstyle==6.3.0
14
+
15
+ [dev-formatting]
16
+ black==25.1.0
17
+ isort==6.0.1
18
+
19
+ [dev-mkdocs]
20
+ Markdown==3.8
21
+ black==25.1.0
22
+ mike==2.1.3
23
+ mkdocs-gen-files==0.5.0
24
+ mkdocs-literate-nav==0.6.2
25
+ mkdocs-macros-plugin==1.3.7
26
+ mkdocs-material==9.6.12
27
+ mkdocstrings[python]==0.29.1
28
+ mkdocstrings-python==1.16.10
29
+ frequenz-repo-config[lib]==0.13.3
30
+
31
+ [dev-mypy]
32
+ mypy==1.15.0
33
+ types-Markdown==3.8.0.20250415
34
+ frequenz-client-common[dev-mkdocs,dev-noxfile,dev-pytest]
35
+
36
+ [dev-noxfile]
37
+ nox==2025.5.1
38
+ frequenz-repo-config[lib]==0.13.3
39
+
40
+ [dev-pylint]
41
+ pylint==3.3.6
42
+ frequenz-client-common[dev-mkdocs,dev-noxfile,dev-pytest]
43
+
44
+ [dev-pytest]
45
+ pytest==8.3.5
46
+ frequenz-repo-config[extra-lint-examples]==0.13.3
47
+ pytest-mock==3.14.0
48
+ pytest-asyncio==0.26.0
49
+ async-solipsism==0.7
@@ -1,19 +0,0 @@
1
- # Frequenz Client Common Library Release Notes
2
-
3
- ## Summary
4
-
5
- Update of the Pagination `Params` data class.
6
-
7
- ## Upgrading
8
-
9
- * Pagination `Params` has been changed such that the `page_size` and `page_token` fields are now no longer optional.
10
-
11
- ## New Features
12
-
13
- * Additional information for energy metric.
14
- * Add component state codes.
15
- * Add component error codes.
16
-
17
- ## Bug Fixes
18
-
19
- <!-- Here goes notable bug fixes that are worth a special mention or explanation -->
@@ -1,4 +0,0 @@
1
- # License: MIT
2
- # Copyright © 2023 Frequenz Energy-as-a-Service GmbH
3
-
4
- """Frequenz microgrid definition."""
@@ -1,48 +0,0 @@
1
- typing-extensions<5,>=4.5.0
2
- frequenz-api-common<7,>=0.6.0
3
-
4
- [dev]
5
- frequenz-client-common[dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]
6
-
7
- [dev-flake8]
8
- flake8==7.1.1
9
- flake8-docstrings==1.7.0
10
- flake8-pyproject==1.2.3
11
- pydoclint==0.5.9
12
- pydocstyle==6.3.0
13
-
14
- [dev-formatting]
15
- black==24.10.0
16
- isort==5.13.2
17
-
18
- [dev-mkdocs]
19
- black==24.10.0
20
- Markdown==3.7
21
- mike==2.1.3
22
- mkdocs-gen-files==0.5.0
23
- mkdocs-literate-nav==0.6.1
24
- mkdocs-macros-plugin==1.3.7
25
- mkdocs-material==9.5.47
26
- mkdocstrings[python]==0.27.0
27
- mkdocstrings-python==1.12.2
28
- frequenz-repo-config[lib]==0.11.0
29
-
30
- [dev-mypy]
31
- mypy==1.13.0
32
- types-Markdown==3.7.0.20241204
33
- frequenz-client-common[dev-mkdocs,dev-noxfile,dev-pytest]
34
-
35
- [dev-noxfile]
36
- nox==2024.10.9
37
- frequenz-repo-config[lib]==0.11.0
38
-
39
- [dev-pylint]
40
- pylint==3.3.2
41
- frequenz-client-common[dev-mkdocs,dev-noxfile,dev-pytest]
42
-
43
- [dev-pytest]
44
- pytest==8.3.4
45
- frequenz-repo-config[extra-lint-examples]==0.11.0
46
- pytest-mock==3.14.0
47
- pytest-asyncio==0.24.0
48
- async-solipsism==0.7