-
Notifications
You must be signed in to change notification settings - Fork 9
Revamp modules structure #235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Having bidirectional channels is not a recommended practice, as it could introduce deadlocks. It is a very niche use case, so it is better to remove it. Signed-off-by: Leandro Lucarella <[email protected]>
`Peekable` was a class that allowed users to peek at the latest value in a channel, without consuming anything. Even when useful in principle, it is a special case that breaks the whole channel abstraction, and can easily be emulated by just using a normal receiver and caching the last value. Also the following symbols are removed as they are not longer used: * 'Broadcast.new_peekable` * `Receiver.into_peekable` * `ReceiverInvalidatedError` Signed-off-by: Leandro Lucarella <[email protected]>
There is little gain in importing type variables from other modules, as it adds unncecessary dependencies between modules. Type variables are just an artifact to define stuff locally. Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
Also move the receiver exceptions from `_exceptions` to `_receiver` and the sender exceptions from `_exceptions` to `_sender`. This avoids circular imports. Signed-off-by: Leandro Lucarella <[email protected]>
We don't really want end users to have access to the concrete types, and their custom methods. We want them to use the base types, so we can change the implementation without breaking their code and ensuring a common interface for all senders and receivers. Signed-off-by: Leandro Lucarella <[email protected]>
We don't want to expose the implementation of the sender and receiver at all, so we make them private to the module. Signed-off-by: Leandro Lucarella <[email protected]>
Now that the sender and receiver implementations are private, there is no need to use aliases for the base classes. Signed-off-by: Leandro Lucarella <[email protected]>
These are core component to work with channels, so they are moved to the `frequenz.channels` top level module. Signed-off-by: Leandro Lucarella <[email protected]>
We move the `Event`, `FileWatcher` and `Timer` receivers to their own separate public modules. Since they are not core components and users might only need to use some of them, it is more clear to have them separated. Also in the case of the `FileWatcher`, it requires an extra dependency, which we could potentially have as an optional dependency, so users that don't need it don't need to install it. In the future we might distribute these also as separate python packages (wheels). Signed-off-by: Leandro Lucarella <[email protected]>
Removing nested classes avoids having to use hacky constructions, like requiring the use of `from __future__ import annotations`, types as strings and confusing the `mkdocstrings` tools when extracting and cross-linking docs. Signed-off-by: Leandro Lucarella <[email protected]>
This is from the beta-2 release, so we clear it out until we are ready for the new release. Signed-off-by: Leandro Lucarella <[email protected]>
Signed-off-by: Leandro Lucarella <[email protected]>
Contributor
Author
|
Added release notes, this is ready for the final review. |
shsms
reviewed
Nov 9, 2023
Contributor
|
Just one comment, looks good otherwise. |
shsms
approved these changes
Nov 9, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
part:channels
Affects channels implementation
part:core
Affects the core types (`Sender`, `Receiver`, exceptions, etc.)
part:docs
Affects the documentation
part:tests
Affects the unit, integration and performance (benchmarks) tests
part:tooling
Affects the development tooling (CI, deployment, dependency management, etc.)
scope:breaking-change
Breaking change, users will need to update their code
type:enhancement
New feature or enhancement visitble to users
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BidirectionalchannelPeekableand associated methods/classesTypeVars from other modulesTypeVars private_base_classesinto_receiverand_senderFixes #233, fixes #234.