|
1 | 1 | # Frequenz Client Base Library Release Notes |
2 | 2 |
|
| 3 | +## Summary |
| 4 | + |
| 5 | +<!-- Here goes a general summary of what this release is about --> |
| 6 | + |
3 | 7 | ## Upgrading |
4 | 8 |
|
5 | | -The `BaseApiClient` class is generic again. There was too many issues with the new approach, so it was rolled back. |
6 | | - |
7 | | -- If you are upgrading from v0.7.x, you should be able to roll back your changes with the upgrade and just keep the new `stub` property. |
8 | | - |
9 | | - ```python |
10 | | - # Old |
11 | | - from __future__ import annotations |
12 | | - import my_service_pb2_grpc |
13 | | - class MyApiClient(BaseApiClient): |
14 | | - def __init__(self, server_url: str, *, ...) -> None: |
15 | | - super().__init__(server_url, ...) |
16 | | - stub = my_service_pb2_grpc.MyServiceStub(self.channel) |
17 | | - self._stub: my_service_pb2_grpc.MyServiceAsyncStub = stub # type: ignore |
18 | | - ... |
19 | | - |
20 | | - @property |
21 | | - def stub(self) -> my_service_pb2_grpc.MyServiceAsyncStub: |
22 | | - if self.channel is None: |
23 | | - raise ClientNotConnected(server_url=self.server_url, operation="stub") |
24 | | - return self._stub |
25 | | - |
26 | | - # New |
27 | | - from __future__ import annotations |
28 | | - import my_service_pb2_grpc |
29 | | - from my_service_pb2_grpc import MyServiceStub |
30 | | - class MyApiClient(BaseApiClient[MyServiceStub]): |
31 | | - def __init__(self, server_url: str, *, ...) -> None: |
32 | | - super().__init__(server_url, MyServiceStub, ...) |
33 | | - ... |
34 | | - |
35 | | - @property |
36 | | - def stub(self) -> my_service_pb2_grpc.MyServiceAsyncStub: |
37 | | - """The gRPC stub for the API.""" |
38 | | - if self.channel is None or self._stub is None: |
39 | | - raise ClientNotConnected(server_url=self.server_url, operation="stub") |
40 | | - # This type: ignore is needed because we need to cast the sync stub to |
41 | | - # the async stub, but we can't use cast because the async stub doesn't |
42 | | - # actually exists to the eyes of the interpreter, it only exists for the |
43 | | - # type-checker, so it can only be used for type hints. |
44 | | - return self._stub # type: ignore |
45 | | - ``` |
46 | | - |
47 | | -- If you are upgrading from v0.6.x, you should only need to add the `stub` property to your client class and then use that property instead of `_stub` in your code. |
48 | | - |
49 | | - ```python |
50 | | - @property |
51 | | - def stub(self) -> my_service_pb2_grpc.MyServiceAsyncStub: |
52 | | - """The gRPC stub for the API.""" |
53 | | - if self.channel is None or self._stub is None: |
54 | | - raise ClientNotConnected(server_url=self.server_url, operation="stub") |
55 | | - # This type: ignore is needed because we need to cast the sync stub to |
56 | | - # the async stub, but we can't use cast because the async stub doesn't |
57 | | - # actually exists to the eyes of the interpreter, it only exists for the |
58 | | - # type-checker, so it can only be used for type hints. |
59 | | - return self._stub # type: ignore |
60 | | - ``` |
| 9 | +<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with --> |
| 10 | + |
| 11 | +## New Features |
| 12 | + |
| 13 | +<!-- Here goes the main new features and examples or instructions on how to use them --> |
| 14 | + |
| 15 | +## Bug Fixes |
| 16 | + |
| 17 | +<!-- Here goes notable bug fixes that are worth a special mention or explanation --> |
0 commit comments