frequenz-client-base 0.11.1__tar.gz → 0.11.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 (27) hide show
  1. {frequenz_client_base-0.11.1/src/frequenz_client_base.egg-info → frequenz_client_base-0.11.3}/PKG-INFO +32 -32
  2. frequenz_client_base-0.11.3/RELEASE_NOTES.md +15 -0
  3. {frequenz_client_base-0.11.1 → frequenz_client_base-0.11.3}/pyproject.toml +36 -33
  4. {frequenz_client_base-0.11.1 → frequenz_client_base-0.11.3}/src/frequenz/client/base/channel.py +22 -10
  5. {frequenz_client_base-0.11.1 → frequenz_client_base-0.11.3}/src/frequenz/client/base/retry.py +4 -0
  6. {frequenz_client_base-0.11.1 → frequenz_client_base-0.11.3}/src/frequenz/client/base/streaming.py +28 -22
  7. {frequenz_client_base-0.11.1 → frequenz_client_base-0.11.3/src/frequenz_client_base.egg-info}/PKG-INFO +32 -32
  8. {frequenz_client_base-0.11.1 → frequenz_client_base-0.11.3}/src/frequenz_client_base.egg-info/SOURCES.txt +2 -0
  9. frequenz_client_base-0.11.3/src/frequenz_client_base.egg-info/requires.txt +57 -0
  10. frequenz_client_base-0.11.3/src/frequenz_client_base.egg-info/scm_file_list.json +60 -0
  11. frequenz_client_base-0.11.3/src/frequenz_client_base.egg-info/scm_version.json +8 -0
  12. frequenz_client_base-0.11.1/RELEASE_NOTES.md +0 -15
  13. frequenz_client_base-0.11.1/src/frequenz_client_base.egg-info/requires.txt +0 -56
  14. {frequenz_client_base-0.11.1 → frequenz_client_base-0.11.3}/LICENSE +0 -0
  15. {frequenz_client_base-0.11.1 → frequenz_client_base-0.11.3}/MANIFEST.in +0 -0
  16. {frequenz_client_base-0.11.1 → frequenz_client_base-0.11.3}/README.md +0 -0
  17. {frequenz_client_base-0.11.1 → frequenz_client_base-0.11.3}/setup.cfg +0 -0
  18. {frequenz_client_base-0.11.1 → frequenz_client_base-0.11.3}/src/frequenz/client/base/__init__.py +0 -0
  19. {frequenz_client_base-0.11.1 → frequenz_client_base-0.11.3}/src/frequenz/client/base/authentication.py +0 -0
  20. {frequenz_client_base-0.11.1 → frequenz_client_base-0.11.3}/src/frequenz/client/base/client.py +0 -0
  21. {frequenz_client_base-0.11.1 → frequenz_client_base-0.11.3}/src/frequenz/client/base/conftest.py +0 -0
  22. {frequenz_client_base-0.11.1 → frequenz_client_base-0.11.3}/src/frequenz/client/base/conversion.py +0 -0
  23. {frequenz_client_base-0.11.1 → frequenz_client_base-0.11.3}/src/frequenz/client/base/exception.py +0 -0
  24. {frequenz_client_base-0.11.1 → frequenz_client_base-0.11.3}/src/frequenz/client/base/py.typed +0 -0
  25. {frequenz_client_base-0.11.1 → frequenz_client_base-0.11.3}/src/frequenz/client/base/signing.py +0 -0
  26. {frequenz_client_base-0.11.1 → frequenz_client_base-0.11.3}/src/frequenz_client_base.egg-info/dependency_links.txt +0 -0
  27. {frequenz_client_base-0.11.1 → frequenz_client_base-0.11.3}/src/frequenz_client_base.egg-info/top_level.txt +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: frequenz-client-base
3
- Version: 0.11.1
3
+ Version: 0.11.3
4
4
  Summary: Utilities for writing Frequenz API clients
5
5
  Author-email: Frequenz Energy-as-a-Service GmbH <floss@frequenz.com>
6
- License: MIT
6
+ License-Expression: MIT
7
7
  Project-URL: Documentation, https://frequenz-floss.github.io/frequenz-client-base-python/
8
8
  Project-URL: Changelog, https://github.com/frequenz-floss/frequenz-client-base-python/releases
9
9
  Project-URL: Issues, https://github.com/frequenz-floss/frequenz-client-base-python/issues
@@ -12,7 +12,6 @@ Project-URL: Support, https://github.com/frequenz-floss/frequenz-client-base-pyt
12
12
  Keywords: frequenz,python,lib,library,client-base
13
13
  Classifier: Development Status :: 3 - Alpha
14
14
  Classifier: Intended Audience :: Developers
15
- Classifier: License :: OSI Approved :: MIT License
16
15
  Classifier: Programming Language :: Python :: 3
17
16
  Classifier: Programming Language :: Python :: 3 :: Only
18
17
  Classifier: Topic :: Software Development :: Libraries
@@ -22,49 +21,50 @@ Description-Content-Type: text/markdown
22
21
  License-File: LICENSE
23
22
  Requires-Dist: frequenz-channels<2,>=1.8.0
24
23
  Requires-Dist: grpcio<2,>=1.59
25
- Requires-Dist: protobuf<7,>=5.29.2
26
- Requires-Dist: typing-extensions<5,>=4.6.0
24
+ Requires-Dist: protobuf<8,>=5.29.2
25
+ Requires-Dist: typing-extensions<5,>=4.12.0
27
26
  Provides-Extra: dev-flake8
28
- Requires-Dist: flake8==7.2.0; extra == "dev-flake8"
27
+ Requires-Dist: flake8==7.4.1; extra == "dev-flake8"
28
+ Requires-Dist: flake8-datetimez==26.8.1; extra == "dev-flake8"
29
29
  Requires-Dist: flake8-docstrings==1.7.0; extra == "dev-flake8"
30
- Requires-Dist: flake8-pyproject==1.2.3; extra == "dev-flake8"
31
- Requires-Dist: pydoclint==0.6.11; extra == "dev-flake8"
30
+ Requires-Dist: flake8-pyproject==1.2.4; extra == "dev-flake8"
31
+ Requires-Dist: pydoclint==0.10.1; extra == "dev-flake8"
32
32
  Requires-Dist: pydocstyle==6.3.0; extra == "dev-flake8"
33
33
  Requires-Dist: frequenz-client-base; extra == "dev-flake8"
34
34
  Provides-Extra: dev-formatting
35
- Requires-Dist: black==25.1.0; extra == "dev-formatting"
36
- Requires-Dist: isort==6.0.1; extra == "dev-formatting"
35
+ Requires-Dist: black==26.5.1; extra == "dev-formatting"
36
+ Requires-Dist: isort==9.0.1; extra == "dev-formatting"
37
37
  Provides-Extra: dev-mkdocs
38
- Requires-Dist: black==25.1.0; extra == "dev-mkdocs"
39
- Requires-Dist: Markdown==3.8.2; extra == "dev-mkdocs"
40
- Requires-Dist: mike==2.1.3; extra == "dev-mkdocs"
41
- Requires-Dist: mkdocs-gen-files==0.5.0; extra == "dev-mkdocs"
42
- Requires-Dist: mkdocs-literate-nav==0.6.2; extra == "dev-mkdocs"
43
- Requires-Dist: mkdocs-macros-plugin==1.3.7; extra == "dev-mkdocs"
44
- Requires-Dist: mkdocs-material==9.6.15; extra == "dev-mkdocs"
45
- Requires-Dist: mkdocstrings[python]==0.30.0; extra == "dev-mkdocs"
46
- Requires-Dist: mkdocstrings-python==1.18.2; extra == "dev-mkdocs"
47
- Requires-Dist: frequenz-repo-config[lib]==0.13.5; extra == "dev-mkdocs"
38
+ Requires-Dist: black==26.5.1; extra == "dev-mkdocs"
39
+ Requires-Dist: Markdown==3.11; extra == "dev-mkdocs"
40
+ Requires-Dist: mike==2.2.0; extra == "dev-mkdocs"
41
+ Requires-Dist: mkdocs-gen-files==0.6.1; extra == "dev-mkdocs"
42
+ Requires-Dist: mkdocs-literate-nav==0.6.3; extra == "dev-mkdocs"
43
+ Requires-Dist: mkdocs-macros-plugin==1.5.0; extra == "dev-mkdocs"
44
+ Requires-Dist: mkdocs-material==9.7.7; extra == "dev-mkdocs"
45
+ Requires-Dist: mkdocstrings[python]==1.0.6; extra == "dev-mkdocs"
46
+ Requires-Dist: mkdocstrings-python==2.0.9; extra == "dev-mkdocs"
47
+ Requires-Dist: frequenz-repo-config[lib]==0.19.0; extra == "dev-mkdocs"
48
48
  Requires-Dist: frequenz-client-base; extra == "dev-mkdocs"
49
49
  Provides-Extra: dev-mypy
50
- Requires-Dist: mypy==1.16.1; extra == "dev-mypy"
51
- Requires-Dist: types-Markdown==3.8.0.20250415; extra == "dev-mypy"
52
- Requires-Dist: types-protobuf==6.30.2.20250516; extra == "dev-mypy"
50
+ Requires-Dist: mypy==2.3.1; extra == "dev-mypy"
51
+ Requires-Dist: types-Markdown==3.10.2.20260712; extra == "dev-mypy"
52
+ Requires-Dist: types-protobuf==7.35.1.20260906; extra == "dev-mypy"
53
53
  Requires-Dist: grpc-stubs==1.53.0.6; extra == "dev-mypy"
54
54
  Requires-Dist: frequenz-client-base[dev-mkdocs,dev-noxfile,dev-pytest]; extra == "dev-mypy"
55
55
  Provides-Extra: dev-noxfile
56
- Requires-Dist: nox==2025.5.1; extra == "dev-noxfile"
57
- Requires-Dist: frequenz-repo-config[lib]==0.13.5; extra == "dev-noxfile"
56
+ Requires-Dist: nox==2026.8.17; extra == "dev-noxfile"
57
+ Requires-Dist: frequenz-repo-config[lib]==0.19.0; extra == "dev-noxfile"
58
58
  Provides-Extra: dev-pylint
59
- Requires-Dist: pylint==3.3.7; extra == "dev-pylint"
59
+ Requires-Dist: pylint==4.0.9; extra == "dev-pylint"
60
60
  Requires-Dist: frequenz-client-base[dev-mkdocs,dev-noxfile,dev-pytest]; extra == "dev-pylint"
61
61
  Provides-Extra: dev-pytest
62
- Requires-Dist: pytest==8.3.5; extra == "dev-pytest"
63
- Requires-Dist: frequenz-repo-config[extra-lint-examples]==0.13.5; extra == "dev-pytest"
64
- Requires-Dist: pytest-mock==3.14.1; extra == "dev-pytest"
65
- Requires-Dist: pytest-asyncio==1.1.0; extra == "dev-pytest"
66
- Requires-Dist: async-solipsism==0.8; extra == "dev-pytest"
67
- Requires-Dist: hypothesis==6.132.0; extra == "dev-pytest"
62
+ Requires-Dist: pytest==9.1.1; extra == "dev-pytest"
63
+ Requires-Dist: frequenz-repo-config[extra-lint-examples]==0.19.0; extra == "dev-pytest"
64
+ Requires-Dist: pytest-mock==3.16.0; extra == "dev-pytest"
65
+ Requires-Dist: pytest-asyncio==1.4.0; extra == "dev-pytest"
66
+ Requires-Dist: async-solipsism==0.9; extra == "dev-pytest"
67
+ Requires-Dist: hypothesis==6.168.3; extra == "dev-pytest"
68
68
  Requires-Dist: frequenz-client-base; extra == "dev-pytest"
69
69
  Provides-Extra: dev
70
70
  Requires-Dist: frequenz-client-base[dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]; extra == "dev"
@@ -0,0 +1,15 @@
1
+ # Frequenz Client Base Library Release Notes
2
+
3
+ ## Summary
4
+
5
+ This release adds support for protobuf 7 and fixes HTTP/2 keep-alive, which was never actually enabled.
6
+
7
+ ## Upgrading
8
+
9
+ - The protobuf requirement is now `>=5.29.2,<8`, allowing protobuf 7 while retaining support for protobuf 5 and 6.
10
+
11
+ ## Bug Fixes
12
+
13
+ - HTTP/2 keep-alive is now actually enabled. `grpc.keepalive_time_ms` and `grpc.keepalive_timeout_ms` were computed with `timedelta.total_seconds() * 1000` and therefore passed as `float`. gRPC silently ignores channel arguments that are neither `int` nor `str`, so no keep-alive pings were ever sent and a client could only detect a dead stream through its own deadline or a teardown sent by the peer.
14
+
15
+ Note that keep-alive pings are answered by the nearest HTTP/2 peer. Where a proxy terminates HTTP/2, successful pings prove that hop is alive, not the backend, so a stream deadline is still needed to detect an orphaned upstream stream.
@@ -3,9 +3,9 @@
3
3
 
4
4
  [build-system]
5
5
  requires = [
6
- "setuptools == 80.9.0",
7
- "setuptools_scm[toml] == 8.3.1",
8
- "frequenz-repo-config[lib] == 0.13.5",
6
+ "setuptools == 84.0.0",
7
+ "setuptools_scm[toml] == 10.3.4",
8
+ "frequenz-repo-config[lib] == 0.19.0",
9
9
  ]
10
10
  build-backend = "setuptools.build_meta"
11
11
 
@@ -13,12 +13,12 @@ build-backend = "setuptools.build_meta"
13
13
  name = "frequenz-client-base"
14
14
  description = "Utilities for writing Frequenz API clients"
15
15
  readme = "README.md"
16
- license = { text = "MIT" }
16
+ license = "MIT"
17
+ license-files = ["LICENSE"]
17
18
  keywords = ["frequenz", "python", "lib", "library", "client-base"]
18
19
  classifiers = [
19
20
  "Development Status :: 3 - Alpha",
20
21
  "Intended Audience :: Developers",
21
- "License :: OSI Approved :: MIT License",
22
22
  "Programming Language :: Python :: 3",
23
23
  "Programming Language :: Python :: 3 :: Only",
24
24
  "Topic :: Software Development :: Libraries",
@@ -28,8 +28,8 @@ requires-python = ">= 3.11, < 4"
28
28
  dependencies = [
29
29
  "frequenz-channels >= 1.8.0, < 2",
30
30
  "grpcio >= 1.59, < 2",
31
- "protobuf >= 5.29.2, < 7",
32
- "typing-extensions >= 4.6.0, < 5",
31
+ "protobuf >= 5.29.2, < 8",
32
+ "typing-extensions >= 4.12.0, < 5",
33
33
  ]
34
34
  dynamic = ["version"]
35
35
 
@@ -39,48 +39,49 @@ email = "floss@frequenz.com"
39
39
 
40
40
  [project.optional-dependencies]
41
41
  dev-flake8 = [
42
- "flake8 == 7.2.0",
42
+ "flake8 == 7.4.1",
43
+ "flake8-datetimez == 26.8.1",
43
44
  "flake8-docstrings == 1.7.0",
44
- "flake8-pyproject == 1.2.3", # For reading the flake8 config from pyproject.toml
45
- "pydoclint == 0.6.11",
45
+ "flake8-pyproject == 1.2.4", # For reading the flake8 config from pyproject.toml
46
+ "pydoclint == 0.10.1",
46
47
  "pydocstyle == 6.3.0",
47
48
  "frequenz-client-base",
48
49
  ]
49
- dev-formatting = ["black == 25.1.0", "isort == 6.0.1"]
50
+ dev-formatting = ["black == 26.5.1", "isort == 9.0.1"]
50
51
  dev-mkdocs = [
51
- "black == 25.1.0",
52
- "Markdown==3.8.2",
53
- "mike == 2.1.3",
54
- "mkdocs-gen-files == 0.5.0",
55
- "mkdocs-literate-nav == 0.6.2",
56
- "mkdocs-macros-plugin == 1.3.7",
57
- "mkdocs-material == 9.6.15",
58
- "mkdocstrings[python] == 0.30.0",
59
- "mkdocstrings-python == 1.18.2",
60
- "frequenz-repo-config[lib] == 0.13.5",
52
+ "black == 26.5.1",
53
+ "Markdown==3.11",
54
+ "mike == 2.2.0",
55
+ "mkdocs-gen-files == 0.6.1",
56
+ "mkdocs-literate-nav == 0.6.3",
57
+ "mkdocs-macros-plugin == 1.5.0",
58
+ "mkdocs-material == 9.7.7",
59
+ "mkdocstrings[python] == 1.0.6",
60
+ "mkdocstrings-python == 2.0.9",
61
+ "frequenz-repo-config[lib] == 0.19.0",
61
62
  "frequenz-client-base",
62
63
  ]
63
64
  dev-mypy = [
64
- "mypy == 1.16.1",
65
- "types-Markdown == 3.8.0.20250415",
66
- "types-protobuf == 6.30.2.20250516",
65
+ "mypy == 2.3.1",
66
+ "types-Markdown == 3.10.2.20260712",
67
+ "types-protobuf == 7.35.1.20260906",
67
68
  "grpc-stubs == 1.53.0.6", # This dependency introduces breaking changes in patch releases
68
69
  # For checking the noxfile, docs/ script, and tests
69
70
  "frequenz-client-base[dev-mkdocs,dev-noxfile,dev-pytest]",
70
71
  ]
71
- dev-noxfile = ["nox == 2025.5.1", "frequenz-repo-config[lib] == 0.13.5"]
72
+ dev-noxfile = ["nox == 2026.8.17", "frequenz-repo-config[lib] == 0.19.0"]
72
73
  dev-pylint = [
73
- "pylint == 3.3.7",
74
+ "pylint == 4.0.9",
74
75
  # For checking the noxfile, docs/ script, and tests
75
76
  "frequenz-client-base[dev-mkdocs,dev-noxfile,dev-pytest]",
76
77
  ]
77
78
  dev-pytest = [
78
- "pytest == 8.3.5",
79
- "frequenz-repo-config[extra-lint-examples] == 0.13.5",
80
- "pytest-mock == 3.14.1",
81
- "pytest-asyncio == 1.1.0",
82
- "async-solipsism == 0.8",
83
- "hypothesis == 6.132.0",
79
+ "pytest == 9.1.1",
80
+ "frequenz-repo-config[extra-lint-examples] == 0.19.0",
81
+ "pytest-mock == 3.16.0",
82
+ "pytest-asyncio == 1.4.0",
83
+ "async-solipsism == 0.9",
84
+ "hypothesis == 6.168.3",
84
85
  "frequenz-client-base",
85
86
  ]
86
87
  dev = [
@@ -155,13 +156,15 @@ disable = [
155
156
  ]
156
157
 
157
158
  [tool.pytest.ini_options]
158
- addopts = "-W=all -Werror -Wdefault::DeprecationWarning -Wdefault::PendingDeprecationWarning -vv"
159
+ addopts = "-W=all -Werror -Wdefault::DeprecationWarning -Wdefault::PendingDeprecationWarning"
159
160
  testpaths = ["tests", "src"]
161
+ asyncio_debug = true
160
162
  asyncio_mode = "auto"
161
163
  asyncio_default_fixture_loop_scope = "function"
162
164
  required_plugins = ["pytest-asyncio", "pytest-mock"]
163
165
 
164
166
  [tool.mypy]
167
+ enable_error_code = ["exhaustive-match"]
165
168
  explicit_package_bases = true
166
169
  namespace_packages = true
167
170
  # This option disables mypy cache, and it is sometimes useful to enable it if
@@ -162,23 +162,19 @@ def parse_grpc_uri(
162
162
  ("grpc.keepalive_permit_without_calls", 1),
163
163
  (
164
164
  "grpc.keepalive_time_ms",
165
- (
166
- (
167
- defaults.keep_alive.interval
168
- if options.keep_alive_interval is None
169
- else options.keep_alive_interval
170
- ).total_seconds()
171
- * 1000
165
+ _to_millis(
166
+ defaults.keep_alive.interval
167
+ if options.keep_alive_interval is None
168
+ else options.keep_alive_interval
172
169
  ),
173
170
  ),
174
171
  (
175
172
  "grpc.keepalive_timeout_ms",
176
- (
173
+ _to_millis(
177
174
  defaults.keep_alive.timeout
178
175
  if options.keep_alive_timeout is None
179
176
  else options.keep_alive_timeout
180
- ).total_seconds()
181
- * 1000,
177
+ ),
182
178
  ),
183
179
  ]
184
180
  if keep_alive
@@ -212,6 +208,22 @@ def parse_grpc_uri(
212
208
  return insecure_channel(target, channel_options, interceptors=interceptors)
213
209
 
214
210
 
211
+ def _to_millis(duration: timedelta) -> int:
212
+ """Convert a duration to whole milliseconds.
213
+
214
+ gRPC channel arguments must be `int` or `str`. grpc-python silently ignores
215
+ arguments of any other type, so passing a `float` disables the option instead
216
+ of raising an error.
217
+
218
+ Args:
219
+ duration: The duration to convert.
220
+
221
+ Returns:
222
+ The duration in whole milliseconds.
223
+ """
224
+ return int(duration.total_seconds() * 1000)
225
+
226
+
215
227
  def _to_bool(value: str) -> bool:
216
228
  value = value.lower()
217
229
  if value in ("true", "on", "1"):
@@ -9,6 +9,8 @@ from collections.abc import Iterator
9
9
  from copy import deepcopy
10
10
  from typing import Self
11
11
 
12
+ from typing_extensions import override
13
+
12
14
  DEFAULT_RETRY_INTERVAL = 3.0
13
15
  """Default retry interval, in seconds."""
14
16
 
@@ -98,6 +100,7 @@ class LinearBackoff(Strategy):
98
100
 
99
101
  self._count = 0
100
102
 
103
+ @override
101
104
  def next_interval(self) -> float | None:
102
105
  """Return the time to wait before the next retry.
103
106
 
@@ -153,6 +156,7 @@ class ExponentialBackoff(Strategy):
153
156
 
154
157
  self._count = 0
155
158
 
159
+ @override
156
160
  def next_interval(self) -> float | None:
157
161
  """Return the time to wait before the next retry.
158
162
 
@@ -8,7 +8,7 @@ import logging
8
8
  from collections.abc import Callable
9
9
  from dataclasses import dataclass
10
10
  from datetime import timedelta
11
- from typing import Generic, Literal, TypeAlias, TypeVar, overload
11
+ from typing import AsyncIterable, Generic, Literal, TypeAlias, TypeVar, overload
12
12
 
13
13
  import grpc.aio
14
14
 
@@ -19,10 +19,6 @@ from . import retry
19
19
  _logger = logging.getLogger(__name__)
20
20
 
21
21
 
22
- RequestT = TypeVar("RequestT")
23
- """The request type of the stream."""
24
-
25
-
26
22
  InputT = TypeVar("InputT")
27
23
  """The input type of the stream."""
28
24
 
@@ -80,20 +76,31 @@ class GrpcStreamBroadcaster(Generic[InputT, OutputT]):
80
76
 
81
77
  Example:
82
78
  ```python
83
- from typing import Any
84
79
  from frequenz.client.base import (
85
80
  GrpcStreamBroadcaster,
86
81
  StreamFatalError,
87
82
  StreamRetrying,
88
83
  StreamStarted,
89
84
  )
90
- from frequenz.channels import Receiver
85
+ from frequenz.channels import Receiver # Assuming Receiver is available
86
+
87
+ # Dummy async iterable for demonstration
88
+ async def async_range(fail_after: int = -1) -> AsyncIterable[int]:
89
+ for i in range(10):
90
+ if fail_after != -1 and i >= fail_after:
91
+ raise grpc.aio.AioRpcError(
92
+ code=grpc.StatusCode.UNAVAILABLE,
93
+ initial_metadata=grpc.aio.Metadata(),
94
+ trailing_metadata=grpc.aio.Metadata(),
95
+ details="Simulated error"
96
+ )
97
+ yield i
98
+ await asyncio.sleep(0.1)
91
99
 
92
100
  async def main():
93
- stub: Any = ... # The gRPC stub
94
101
  streamer = GrpcStreamBroadcaster(
95
102
  stream_name="example_stream",
96
- stream_method=stub.MyStreamingMethod,
103
+ stream_method=lambda: async_range(fail_after=3),
97
104
  transform=lambda msg: msg * 2, # transform messages
98
105
  retry_on_exhausted_stream=False,
99
106
  )
@@ -149,7 +156,7 @@ class GrpcStreamBroadcaster(Generic[InputT, OutputT]):
149
156
  def __init__( # pylint: disable=too-many-arguments,too-many-positional-arguments
150
157
  self,
151
158
  stream_name: str,
152
- stream_method: Callable[[], grpc.aio.UnaryStreamCall[RequestT, InputT]],
159
+ stream_method: Callable[[], AsyncIterable[InputT]],
153
160
  transform: Callable[[InputT], OutputT],
154
161
  retry_strategy: retry.Strategy | None = None,
155
162
  retry_on_exhausted_stream: bool = False,
@@ -275,30 +282,29 @@ class GrpcStreamBroadcaster(Generic[InputT, OutputT]):
275
282
 
276
283
  while True:
277
284
  error: Exception | None = None
278
- first_message_received = False
279
285
  _logger.info("%s: starting to stream", self._stream_name)
280
286
  try:
281
287
  call = self._stream_method()
282
288
 
283
- # We await for the initial metadata before sending a
284
- # StreamStarted event. This is the best indication we have of a
285
- # successful connection without delaying it until the first
286
- # message is received, which might happen a long time after the
287
- # "connection" was established.
288
- await call.initial_metadata()
289
289
  if self._event_sender:
290
290
  await self._event_sender.send(StreamStarted())
291
291
 
292
292
  async for msg in call:
293
- first_message_received = True
294
- await data_sender.send(self._transform(msg))
293
+ try:
294
+ transformed = self._transform(msg)
295
+ except Exception: # pylint: disable=broad-exception-caught
296
+ _logger.exception(
297
+ "%s: error transforming message: %s",
298
+ self._stream_name,
299
+ msg,
300
+ )
301
+ continue
302
+
303
+ await data_sender.send(transformed)
295
304
 
296
305
  except grpc.aio.AioRpcError as err:
297
306
  error = err
298
307
 
299
- if first_message_received:
300
- self._retry_strategy.reset()
301
-
302
308
  if error is None and not self._retry_on_exhausted_stream:
303
309
  _logger.info(
304
310
  "%s: connection closed, stream exhausted", self._stream_name
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: frequenz-client-base
3
- Version: 0.11.1
3
+ Version: 0.11.3
4
4
  Summary: Utilities for writing Frequenz API clients
5
5
  Author-email: Frequenz Energy-as-a-Service GmbH <floss@frequenz.com>
6
- License: MIT
6
+ License-Expression: MIT
7
7
  Project-URL: Documentation, https://frequenz-floss.github.io/frequenz-client-base-python/
8
8
  Project-URL: Changelog, https://github.com/frequenz-floss/frequenz-client-base-python/releases
9
9
  Project-URL: Issues, https://github.com/frequenz-floss/frequenz-client-base-python/issues
@@ -12,7 +12,6 @@ Project-URL: Support, https://github.com/frequenz-floss/frequenz-client-base-pyt
12
12
  Keywords: frequenz,python,lib,library,client-base
13
13
  Classifier: Development Status :: 3 - Alpha
14
14
  Classifier: Intended Audience :: Developers
15
- Classifier: License :: OSI Approved :: MIT License
16
15
  Classifier: Programming Language :: Python :: 3
17
16
  Classifier: Programming Language :: Python :: 3 :: Only
18
17
  Classifier: Topic :: Software Development :: Libraries
@@ -22,49 +21,50 @@ Description-Content-Type: text/markdown
22
21
  License-File: LICENSE
23
22
  Requires-Dist: frequenz-channels<2,>=1.8.0
24
23
  Requires-Dist: grpcio<2,>=1.59
25
- Requires-Dist: protobuf<7,>=5.29.2
26
- Requires-Dist: typing-extensions<5,>=4.6.0
24
+ Requires-Dist: protobuf<8,>=5.29.2
25
+ Requires-Dist: typing-extensions<5,>=4.12.0
27
26
  Provides-Extra: dev-flake8
28
- Requires-Dist: flake8==7.2.0; extra == "dev-flake8"
27
+ Requires-Dist: flake8==7.4.1; extra == "dev-flake8"
28
+ Requires-Dist: flake8-datetimez==26.8.1; extra == "dev-flake8"
29
29
  Requires-Dist: flake8-docstrings==1.7.0; extra == "dev-flake8"
30
- Requires-Dist: flake8-pyproject==1.2.3; extra == "dev-flake8"
31
- Requires-Dist: pydoclint==0.6.11; extra == "dev-flake8"
30
+ Requires-Dist: flake8-pyproject==1.2.4; extra == "dev-flake8"
31
+ Requires-Dist: pydoclint==0.10.1; extra == "dev-flake8"
32
32
  Requires-Dist: pydocstyle==6.3.0; extra == "dev-flake8"
33
33
  Requires-Dist: frequenz-client-base; extra == "dev-flake8"
34
34
  Provides-Extra: dev-formatting
35
- Requires-Dist: black==25.1.0; extra == "dev-formatting"
36
- Requires-Dist: isort==6.0.1; extra == "dev-formatting"
35
+ Requires-Dist: black==26.5.1; extra == "dev-formatting"
36
+ Requires-Dist: isort==9.0.1; extra == "dev-formatting"
37
37
  Provides-Extra: dev-mkdocs
38
- Requires-Dist: black==25.1.0; extra == "dev-mkdocs"
39
- Requires-Dist: Markdown==3.8.2; extra == "dev-mkdocs"
40
- Requires-Dist: mike==2.1.3; extra == "dev-mkdocs"
41
- Requires-Dist: mkdocs-gen-files==0.5.0; extra == "dev-mkdocs"
42
- Requires-Dist: mkdocs-literate-nav==0.6.2; extra == "dev-mkdocs"
43
- Requires-Dist: mkdocs-macros-plugin==1.3.7; extra == "dev-mkdocs"
44
- Requires-Dist: mkdocs-material==9.6.15; extra == "dev-mkdocs"
45
- Requires-Dist: mkdocstrings[python]==0.30.0; extra == "dev-mkdocs"
46
- Requires-Dist: mkdocstrings-python==1.18.2; extra == "dev-mkdocs"
47
- Requires-Dist: frequenz-repo-config[lib]==0.13.5; extra == "dev-mkdocs"
38
+ Requires-Dist: black==26.5.1; extra == "dev-mkdocs"
39
+ Requires-Dist: Markdown==3.11; extra == "dev-mkdocs"
40
+ Requires-Dist: mike==2.2.0; extra == "dev-mkdocs"
41
+ Requires-Dist: mkdocs-gen-files==0.6.1; extra == "dev-mkdocs"
42
+ Requires-Dist: mkdocs-literate-nav==0.6.3; extra == "dev-mkdocs"
43
+ Requires-Dist: mkdocs-macros-plugin==1.5.0; extra == "dev-mkdocs"
44
+ Requires-Dist: mkdocs-material==9.7.7; extra == "dev-mkdocs"
45
+ Requires-Dist: mkdocstrings[python]==1.0.6; extra == "dev-mkdocs"
46
+ Requires-Dist: mkdocstrings-python==2.0.9; extra == "dev-mkdocs"
47
+ Requires-Dist: frequenz-repo-config[lib]==0.19.0; extra == "dev-mkdocs"
48
48
  Requires-Dist: frequenz-client-base; extra == "dev-mkdocs"
49
49
  Provides-Extra: dev-mypy
50
- Requires-Dist: mypy==1.16.1; extra == "dev-mypy"
51
- Requires-Dist: types-Markdown==3.8.0.20250415; extra == "dev-mypy"
52
- Requires-Dist: types-protobuf==6.30.2.20250516; extra == "dev-mypy"
50
+ Requires-Dist: mypy==2.3.1; extra == "dev-mypy"
51
+ Requires-Dist: types-Markdown==3.10.2.20260712; extra == "dev-mypy"
52
+ Requires-Dist: types-protobuf==7.35.1.20260906; extra == "dev-mypy"
53
53
  Requires-Dist: grpc-stubs==1.53.0.6; extra == "dev-mypy"
54
54
  Requires-Dist: frequenz-client-base[dev-mkdocs,dev-noxfile,dev-pytest]; extra == "dev-mypy"
55
55
  Provides-Extra: dev-noxfile
56
- Requires-Dist: nox==2025.5.1; extra == "dev-noxfile"
57
- Requires-Dist: frequenz-repo-config[lib]==0.13.5; extra == "dev-noxfile"
56
+ Requires-Dist: nox==2026.8.17; extra == "dev-noxfile"
57
+ Requires-Dist: frequenz-repo-config[lib]==0.19.0; extra == "dev-noxfile"
58
58
  Provides-Extra: dev-pylint
59
- Requires-Dist: pylint==3.3.7; extra == "dev-pylint"
59
+ Requires-Dist: pylint==4.0.9; extra == "dev-pylint"
60
60
  Requires-Dist: frequenz-client-base[dev-mkdocs,dev-noxfile,dev-pytest]; extra == "dev-pylint"
61
61
  Provides-Extra: dev-pytest
62
- Requires-Dist: pytest==8.3.5; extra == "dev-pytest"
63
- Requires-Dist: frequenz-repo-config[extra-lint-examples]==0.13.5; extra == "dev-pytest"
64
- Requires-Dist: pytest-mock==3.14.1; extra == "dev-pytest"
65
- Requires-Dist: pytest-asyncio==1.1.0; extra == "dev-pytest"
66
- Requires-Dist: async-solipsism==0.8; extra == "dev-pytest"
67
- Requires-Dist: hypothesis==6.132.0; extra == "dev-pytest"
62
+ Requires-Dist: pytest==9.1.1; extra == "dev-pytest"
63
+ Requires-Dist: frequenz-repo-config[extra-lint-examples]==0.19.0; extra == "dev-pytest"
64
+ Requires-Dist: pytest-mock==3.16.0; extra == "dev-pytest"
65
+ Requires-Dist: pytest-asyncio==1.4.0; extra == "dev-pytest"
66
+ Requires-Dist: async-solipsism==0.9; extra == "dev-pytest"
67
+ Requires-Dist: hypothesis==6.168.3; extra == "dev-pytest"
68
68
  Requires-Dist: frequenz-client-base; extra == "dev-pytest"
69
69
  Provides-Extra: dev
70
70
  Requires-Dist: frequenz-client-base[dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]; extra == "dev"
@@ -18,4 +18,6 @@ src/frequenz_client_base.egg-info/PKG-INFO
18
18
  src/frequenz_client_base.egg-info/SOURCES.txt
19
19
  src/frequenz_client_base.egg-info/dependency_links.txt
20
20
  src/frequenz_client_base.egg-info/requires.txt
21
+ src/frequenz_client_base.egg-info/scm_file_list.json
22
+ src/frequenz_client_base.egg-info/scm_version.json
21
23
  src/frequenz_client_base.egg-info/top_level.txt
@@ -0,0 +1,57 @@
1
+ frequenz-channels<2,>=1.8.0
2
+ grpcio<2,>=1.59
3
+ protobuf<8,>=5.29.2
4
+ typing-extensions<5,>=4.12.0
5
+
6
+ [dev]
7
+ frequenz-client-base[dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]
8
+
9
+ [dev-flake8]
10
+ flake8==7.4.1
11
+ flake8-datetimez==26.8.1
12
+ flake8-docstrings==1.7.0
13
+ flake8-pyproject==1.2.4
14
+ pydoclint==0.10.1
15
+ pydocstyle==6.3.0
16
+ frequenz-client-base
17
+
18
+ [dev-formatting]
19
+ black==26.5.1
20
+ isort==9.0.1
21
+
22
+ [dev-mkdocs]
23
+ black==26.5.1
24
+ Markdown==3.11
25
+ mike==2.2.0
26
+ mkdocs-gen-files==0.6.1
27
+ mkdocs-literate-nav==0.6.3
28
+ mkdocs-macros-plugin==1.5.0
29
+ mkdocs-material==9.7.7
30
+ mkdocstrings[python]==1.0.6
31
+ mkdocstrings-python==2.0.9
32
+ frequenz-repo-config[lib]==0.19.0
33
+ frequenz-client-base
34
+
35
+ [dev-mypy]
36
+ mypy==2.3.1
37
+ types-Markdown==3.10.2.20260712
38
+ types-protobuf==7.35.1.20260906
39
+ grpc-stubs==1.53.0.6
40
+ frequenz-client-base[dev-mkdocs,dev-noxfile,dev-pytest]
41
+
42
+ [dev-noxfile]
43
+ nox==2026.8.17
44
+ frequenz-repo-config[lib]==0.19.0
45
+
46
+ [dev-pylint]
47
+ pylint==4.0.9
48
+ frequenz-client-base[dev-mkdocs,dev-noxfile,dev-pytest]
49
+
50
+ [dev-pytest]
51
+ pytest==9.1.1
52
+ frequenz-repo-config[extra-lint-examples]==0.19.0
53
+ pytest-mock==3.16.0
54
+ pytest-asyncio==1.4.0
55
+ async-solipsism==0.9
56
+ hypothesis==6.168.3
57
+ frequenz-client-base
@@ -0,0 +1,60 @@
1
+ {
2
+ "files": [
3
+ ".cookiecutter-replay.json",
4
+ ".editorconfig",
5
+ ".github/ISSUE_TEMPLATE/bug.yml",
6
+ ".github/ISSUE_TEMPLATE/config.yml",
7
+ ".github/ISSUE_TEMPLATE/feature.yml",
8
+ ".github/RELEASE_NOTES.template.md",
9
+ ".github/dependabot.yml",
10
+ ".github/keylabeler.yml",
11
+ ".github/labeler.yml",
12
+ ".github/workflows/auto-dependabot.yaml",
13
+ ".github/workflows/black-migration.yaml",
14
+ ".github/workflows/ci-pr.yaml",
15
+ ".github/workflows/ci.yaml",
16
+ ".github/workflows/isort-migration.yaml",
17
+ ".github/workflows/labeler.yml",
18
+ ".github/workflows/release-notes-check.yml",
19
+ ".github/workflows/repo-config-migration.yaml",
20
+ ".gitignore",
21
+ "CODEOWNERS",
22
+ "CONTRIBUTING.md",
23
+ "LICENSE",
24
+ "MANIFEST.in",
25
+ "README.md",
26
+ "RELEASE_NOTES.md",
27
+ "docs/CONTRIBUTING.md",
28
+ "docs/SUMMARY.md",
29
+ "docs/_css/mkdocstrings.css",
30
+ "docs/_css/style.css",
31
+ "docs/_img/logo.png",
32
+ "docs/_overrides/main.html",
33
+ "docs/_scripts/mkdocstrings_autoapi.py",
34
+ "docs/index.md",
35
+ "mkdocs.yml",
36
+ "noxfile.py",
37
+ "pyproject.toml",
38
+ "src/frequenz/client/base/__init__.py",
39
+ "src/frequenz/client/base/authentication.py",
40
+ "src/frequenz/client/base/channel.py",
41
+ "src/frequenz/client/base/client.py",
42
+ "src/frequenz/client/base/conftest.py",
43
+ "src/frequenz/client/base/conversion.py",
44
+ "src/frequenz/client/base/exception.py",
45
+ "src/frequenz/client/base/py.typed",
46
+ "src/frequenz/client/base/retry.py",
47
+ "src/frequenz/client/base/signing.py",
48
+ "src/frequenz/client/base/streaming.py",
49
+ "tests/__init__.py",
50
+ "tests/retry_strategy/__init__.py",
51
+ "tests/retry_strategy/test_retry_strategy.py",
52
+ "tests/streaming/test_grpc_stream_broadcaster.py",
53
+ "tests/test_authentication.py",
54
+ "tests/test_channel.py",
55
+ "tests/test_client.py",
56
+ "tests/test_conversion.py",
57
+ "tests/test_exception.py",
58
+ "tests/test_signing.py"
59
+ ]
60
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "0.11.3",
3
+ "distance": 0,
4
+ "node": "g9c9ae9df1c34688f7c27f10c48ebfc49c64433d7",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-10-05"
8
+ }
@@ -1,15 +0,0 @@
1
- # Frequenz Client Base Library Release Notes
2
-
3
- ## Upgrading
4
-
5
- * There is very minor breaking change in this release, `GrpcStreamBroadcaster` now requires a `grpc.aio.UnaryStreamCall` instead of a `AsyncIterable` for the `stream_method` argument. In practice all users should be passing a `grpc.aio.UnaryStreamCall` already, so this should not affect anyone unless they are doing something very strange.
6
-
7
- ## Bug Fixes
8
-
9
- * `GrpcStreamBroadcaster`: Fix potential long delays on retries, and giving up early if the number of retries is limited.
10
-
11
- The retry strategy was not reset after a successful start of the stream, so the back-off delays would accumulate over multiple retries and eventually give up if the number of retries were limited, even if there was a successful start of the stream in between. Now we properly reset the retry strategy after a successful start of the stream (successfully receiving the first item from the stream).
12
-
13
- * `GrpcStreamBroadcaster`: Fix `StreamStarted` event firing too soon.
14
-
15
- The `StreamStarted` event was being fired as soon as the streamming method was called, but that doesn't mean that a streamming connection was established with the server at all, which can give a false impression that the stream is active and working. Now we wait until we receive the initial metadata from the server before firing the `StreamStarted` event. That should give users a better indication that the stream is actually active and working without having to wait for the first item to be received, which can take a long time for some low-frequency streams.
@@ -1,56 +0,0 @@
1
- frequenz-channels<2,>=1.8.0
2
- grpcio<2,>=1.59
3
- protobuf<7,>=5.29.2
4
- typing-extensions<5,>=4.6.0
5
-
6
- [dev]
7
- frequenz-client-base[dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]
8
-
9
- [dev-flake8]
10
- flake8==7.2.0
11
- flake8-docstrings==1.7.0
12
- flake8-pyproject==1.2.3
13
- pydoclint==0.6.11
14
- pydocstyle==6.3.0
15
- frequenz-client-base
16
-
17
- [dev-formatting]
18
- black==25.1.0
19
- isort==6.0.1
20
-
21
- [dev-mkdocs]
22
- black==25.1.0
23
- Markdown==3.8.2
24
- mike==2.1.3
25
- mkdocs-gen-files==0.5.0
26
- mkdocs-literate-nav==0.6.2
27
- mkdocs-macros-plugin==1.3.7
28
- mkdocs-material==9.6.15
29
- mkdocstrings[python]==0.30.0
30
- mkdocstrings-python==1.18.2
31
- frequenz-repo-config[lib]==0.13.5
32
- frequenz-client-base
33
-
34
- [dev-mypy]
35
- mypy==1.16.1
36
- types-Markdown==3.8.0.20250415
37
- types-protobuf==6.30.2.20250516
38
- grpc-stubs==1.53.0.6
39
- frequenz-client-base[dev-mkdocs,dev-noxfile,dev-pytest]
40
-
41
- [dev-noxfile]
42
- nox==2025.5.1
43
- frequenz-repo-config[lib]==0.13.5
44
-
45
- [dev-pylint]
46
- pylint==3.3.7
47
- frequenz-client-base[dev-mkdocs,dev-noxfile,dev-pytest]
48
-
49
- [dev-pytest]
50
- pytest==8.3.5
51
- frequenz-repo-config[extra-lint-examples]==0.13.5
52
- pytest-mock==3.14.1
53
- pytest-asyncio==1.1.0
54
- async-solipsism==0.8
55
- hypothesis==6.132.0
56
- frequenz-client-base