Skip to content
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

Revamp modules structure #235

Merged
merged 13 commits into from
Nov 9, 2023
Merged

Revamp modules structure #235

merged 13 commits into from
Nov 9, 2023

Commits on Nov 7, 2023

  1. Remove Bidirectional channel

    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 <luca-frequenz@llucax.com>
    llucax committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    db1a80d View commit details
    Browse the repository at this point in the history
  2. Remove Peekable and associated methods/classes

    `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 <luca-frequenz@llucax.com>
    llucax committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    6f73235 View commit details
    Browse the repository at this point in the history
  3. Don't import TypeVars from other modules

    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 <luca-frequenz@llucax.com>
    llucax committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    e1358ec View commit details
    Browse the repository at this point in the history
  4. Make all TypeVars private

    Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
    llucax committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    cb68d99 View commit details
    Browse the repository at this point in the history
  5. Split _base_classes into _receiver and _sender

    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 <luca-frequenz@llucax.com>
    llucax committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    f7c86cc View commit details
    Browse the repository at this point in the history
  6. Make channels return the base sender and receiver types

    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 <luca-frequenz@llucax.com>
    llucax committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    805b70f View commit details
    Browse the repository at this point in the history
  7. Make channel's sender and receiver implementation private

    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 <luca-frequenz@llucax.com>
    llucax committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    1708cb2 View commit details
    Browse the repository at this point in the history
  8. Don't use aliases for the base sender and receiver classes

    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 <luca-frequenz@llucax.com>
    llucax committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    b17803d View commit details
    Browse the repository at this point in the history
  9. Move merge and select symbols to the top level

    These are core component to work with channels, so they are moved to the
    `frequenz.channels` top level module.
    
    Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
    llucax committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    c3951f7 View commit details
    Browse the repository at this point in the history
  10. Move utility receivers to their own public modules

    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 <luca-frequenz@llucax.com>
    llucax committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    25b38ba View commit details
    Browse the repository at this point in the history
  11. Move nested class out of the parent class

    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 <luca-frequenz@llucax.com>
    llucax committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    dd756d7 View commit details
    Browse the repository at this point in the history

Commits on Nov 8, 2023

  1. Remove release notes Summary

    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 <luca-frequenz@llucax.com>
    llucax committed Nov 8, 2023
    Configuration menu
    Copy the full SHA
    8e70c41 View commit details
    Browse the repository at this point in the history
  2. Update release notes

    Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
    llucax committed Nov 8, 2023
    Configuration menu
    Copy the full SHA
    cc17298 View commit details
    Browse the repository at this point in the history