|
6 | 6 |
|
7 | 7 | ## Upgrading |
8 | 8 |
|
9 | | -<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with --> |
| 9 | +* `Anycast` |
10 | 10 |
|
11 | | -## New Features |
| 11 | + - `__init__`: The `maxsize` argument was renamed to `limit` and made keyword-only and a new keyword-only `name` argument was added. |
12 | 12 |
|
13 | | -<!-- Here goes the main new features and examples or instructions on how to use them --> |
| 13 | + You should instantiate using `Anycast(name=..., limit=...)` (or `Anycast(name=...)` if the default `limit` is enough) instead of `Anycast(...)` or `Anycast(maxsize=...)`. |
| 14 | + |
| 15 | + - `new_sender` and `new_receiver`: They now return a base `Sender` and `Receiver` class (respectively) instead of a channel-specific `Sender` or `Receiver` subclass. |
| 16 | + |
| 17 | + This means users now don't have access to the internals to the channel-specific `Sender` and `Receiver` subclasses. |
| 18 | + |
| 19 | +* `Broadcast` |
| 20 | + |
| 21 | + - `__init__`: The `name` argument was made optional and keyword-only; `resend_latest` was also made keyword-only. If a `name` is not specified, it will be generated from the `id()` of the instance. |
| 22 | + |
| 23 | + You should instantiate using `Broadcast(name=name, resend_latest=resend_latest)` (or `Broadcast()` if the defaults are enough) instead of `Broadcast(name)` or `Broadcast(name, resend_latest)`. |
| 24 | + |
| 25 | + - `new_receiver`: The `maxsize` argument was renamed to `limit` and made keyword-only; the `name` argument was also made keyword-only. If a `name` is not specified, it will be generated from the `id()` of the instance instead of a random UUID. |
| 26 | + |
| 27 | + You should use `.new_receiver(name=name, limit=limit)` (or `.new_receiver()` if the defaults are enough) instead of `.new_receiver(name)` or `.new_receiver(name, maxsize)`. |
| 28 | + |
| 29 | + - `new_sender` and `new_receiver` now return a base `Sender` and `Receiver` class (respectively) instead of a channel-specific `Sender` or `Receiver` subclass. |
| 30 | + |
| 31 | + This means users now don't have access to the internals to the channel-specific `Sender` and `Receiver` subclasses. |
| 32 | + |
| 33 | +* `Event` |
| 34 | + |
| 35 | + - `__init__`: The `name` argument was made keyword-only. The default was changed to a more readable version of `id(self)`. |
| 36 | + |
| 37 | + You should instantiate using `Event(name=...)` instead of `Event(...)`. |
| 38 | + |
| 39 | + - Moved from `frequenz.channels.util` to `frequenz.channels.event`. |
| 40 | + |
| 41 | +* `FileWatcher` |
| 42 | + |
| 43 | + - Moved from `frequenz.channels.util` to `frequenz.channels.file_watcher`. |
| 44 | + |
| 45 | + - Support classes are no longer nested inside `FileWatcher`. They are now top-level classes within the new `frequenz.channels.file_watcher` module (e.g., `frequenz.channels.util.FileWatcher.EventType` -> `frequenz.channels.file_watcher.EventType`, `frequenz.channels.util.FileWatcher.Event` -> `frequenz.channels.file_watcher.Event`). |
| 46 | + |
| 47 | +* `Timer` and support classes |
| 48 | + |
| 49 | + - Moved from `frequenz.channels.util` to `frequenz.channels.timer`. |
| 50 | + |
| 51 | +* All exceptions that took `Any` as the `message` argument now take `str` instead. |
| 52 | + |
| 53 | + If you were passing a non-`str` value to an exception, you should convert it using `str(value)` before passing it to the exception. |
| 54 | + |
| 55 | +* The following symbols were moved to the top-level `frequenz.channels` package: |
| 56 | + |
| 57 | + - `Selected` |
| 58 | + - `SelectError` |
| 59 | + - `SelectErrorGroup` |
| 60 | + - `UnhandledSelectedError` |
| 61 | + - `select` |
| 62 | + - `selected_from` |
| 63 | + |
| 64 | +### Removals |
| 65 | + |
| 66 | +* `Bidirectional` |
| 67 | + |
| 68 | + This channel was removed as it is not recommended practice and was a niche use case. If you need to use it, you can set up two channels or copy the `Bidirectional` class from the previous version to your project. |
| 69 | + |
| 70 | +* `Merge` |
| 71 | + |
| 72 | + Replaced by the new `merge()` function. When replacing `Merge` with `merge()` please keep in mind that this new function will raise a `ValueError` if no receivers are passed to it. |
| 73 | + |
| 74 | +* `MergeNamed` |
| 75 | + |
| 76 | + This class was redundant, use either the new `merge()` function or `select()` instead. |
| 77 | + |
| 78 | +* `Peekable` |
| 79 | + |
| 80 | + This class was removed because it was merely a shortcut to a receiver that caches the last value received. It did not fit the channel abstraction well and was infrequently used. |
| 81 | + |
| 82 | + You can replace it with a task that receives and retains the last value. |
| 83 | + |
| 84 | +* `Broadcast.new_peekable()` |
| 85 | + |
| 86 | + This was removed alongside `Peekable`. |
| 87 | + |
| 88 | +* `Receiver.into_peekable()` |
| 89 | + |
| 90 | + This was removed alongside `Peekable`. |
| 91 | + |
| 92 | +* `ReceiverInvalidatedError` |
| 93 | + |
| 94 | + This was removed alongside `Peekable` (it was only raised when using a `Receiver` that was converted into a `Peekable`). |
| 95 | + |
| 96 | +* `util` |
| 97 | + |
| 98 | + The entire `util` package was removed and its symbols were either moved to the top-level package or to their own public modules (as noted above). |
| 99 | + |
| 100 | + ## New Features |
| 101 | + |
| 102 | +* A new `merge()` function was added to replace `Merge`. |
| 103 | + |
| 104 | +* `Anycast` |
| 105 | + |
| 106 | + - The following new read-only properties were added: |
| 107 | + |
| 108 | + - `name`: The name of the channel. |
| 109 | + - `limit`: The maximum number of messages that can be sent to the channel. |
| 110 | + - `is_closed`: Whether the channel is closed. |
| 111 | + |
| 112 | + - A more useful implementation of `__str__ and `__repr__` were added for the channel and its senders and receivers. |
| 113 | + |
| 114 | + - A warning will be logged if senders are blocked because the channel buffer is full. |
| 115 | + |
| 116 | +* `Bidirectional` |
| 117 | + |
| 118 | + - The following new read-only properties were added: |
| 119 | + |
| 120 | + - `name`: The name of the channel (read-only). |
| 121 | + - `is_closed`: Whether the channel is closed (read-only). |
| 122 | + |
| 123 | + - A more useful implementation of `__str__ and `__repr__` were added for the channel and the client and service handles. |
| 124 | + |
| 125 | +* `Broadcast` |
| 126 | + |
| 127 | + - The following new read-only properties were added: |
| 128 | + |
| 129 | + - `name`: The name of the channel. |
| 130 | + - `is_closed`: Whether the channel is closed. |
| 131 | + |
| 132 | + - A more useful implementation of `__str__ and `__repr__` were added for the channel and the client and service handles. |
| 133 | + |
| 134 | +* `FileWatcher` |
| 135 | + |
| 136 | + - A more useful implementation of `__str__ and `__repr__` were added. |
| 137 | + |
| 138 | +* `Peekable` |
| 139 | + |
| 140 | + - A more useful implementation of `__str__ and `__repr__` were added. |
| 141 | + |
| 142 | +* `Receiver` |
| 143 | + |
| 144 | + - `map()`: The returned map object now has a more useful implementation of `__str__ and `__repr__`. |
14 | 145 |
|
15 | 146 | ## Bug Fixes |
16 | 147 |
|
|
0 commit comments