Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 13 additions & 56 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,17 @@
# Frequenz Client Base Library Release Notes

## Summary

<!-- Here goes a general summary of what this release is about -->

## Upgrading

The `BaseApiClient` class is generic again. There was too many issues with the new approach, so it was rolled back.

- 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.

```python
# Old
from __future__ import annotations
import my_service_pb2_grpc
class MyApiClient(BaseApiClient):
def __init__(self, server_url: str, *, ...) -> None:
super().__init__(server_url, ...)
stub = my_service_pb2_grpc.MyServiceStub(self.channel)
self._stub: my_service_pb2_grpc.MyServiceAsyncStub = stub # type: ignore
...

@property
def stub(self) -> my_service_pb2_grpc.MyServiceAsyncStub:
if self.channel is None:
raise ClientNotConnected(server_url=self.server_url, operation="stub")
return self._stub

# New
from __future__ import annotations
import my_service_pb2_grpc
from my_service_pb2_grpc import MyServiceStub
class MyApiClient(BaseApiClient[MyServiceStub]):
def __init__(self, server_url: str, *, ...) -> None:
super().__init__(server_url, MyServiceStub, ...)
...

@property
def stub(self) -> my_service_pb2_grpc.MyServiceAsyncStub:
"""The gRPC stub for the API."""
if self.channel is None or self._stub is None:
raise ClientNotConnected(server_url=self.server_url, operation="stub")
# This type: ignore is needed because we need to cast the sync stub to
# the async stub, but we can't use cast because the async stub doesn't
# actually exists to the eyes of the interpreter, it only exists for the
# type-checker, so it can only be used for type hints.
return self._stub # type: ignore
```

- 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.

```python
@property
def stub(self) -> my_service_pb2_grpc.MyServiceAsyncStub:
"""The gRPC stub for the API."""
if self.channel is None or self._stub is None:
raise ClientNotConnected(server_url=self.server_url, operation="stub")
# This type: ignore is needed because we need to cast the sync stub to
# the async stub, but we can't use cast because the async stub doesn't
# actually exists to the eyes of the interpreter, it only exists for the
# type-checker, so it can only be used for type hints.
return self._stub # type: ignore
```
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->

## New Features

<!-- Here goes the main new features and examples or instructions on how to use them -->

## Bug Fixes

<!-- Here goes notable bug fixes that are worth a special mention or explanation -->
Loading