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

Restructure modules and class names #25

Merged
merged 10 commits into from
Mar 1, 2024
Merged

Conversation

llucax
Copy link
Contributor

@llucax llucax commented Feb 29, 2024

This PR do some minor cleanups and some major project structuring to use more consistent and shorter modules and class names.

  • frequenz.client.base.grpc_streaming_helper was renamed to frequenz.client.base.streaming.

    • The GrpcStreamingHelper class was renamed to GrpcStreamBroadcaster.

      • The constructor argument retry_spec was renamed to retry_strategy.
  • frequenz.client.base.retry_strategy was renamed to frequenz.client.base.retry.

    • The RetryStrategy class was renamed to Strategy.

@llucax llucax self-assigned this Feb 29, 2024
@llucax llucax requested review from shsms and Marenz February 29, 2024 09:30
@llucax
Copy link
Contributor Author

llucax commented Feb 29, 2024

I'm planning to improve the docs too, but I will wait until this is merged because I can imagine there could be some push back. BTW, I really think we should eventually rename this project frenquenz-grpc or frequenz-grpcutil or something like that, this is not really a base class for clients but just utilities to deal with gRPC/protobuf.

@llucax llucax added scope:breaking-change Breaking change, users will need to update their code type:enhancement New feature or enhancement visitble to users labels Feb 29, 2024
@llucax llucax requested a review from a team as a code owner February 29, 2024 09:34
@leandro-lucarella-frequenz leandro-lucarella-frequenz added this to the v0.2.0 milestone Feb 29, 2024
Marenz
Marenz previously approved these changes Feb 29, 2024
The comments are using the old v4 syntax, so it might confuse users
trying to add more rules.

We consider all files under `docs/_scripts/` as tooling, and we remove
the TODO as the work was already done.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
The `aio` module doesn't seem to be properly exposed in the `grpc`
package and it makes `pyright` think it doesn't exist.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
The `grpcio-tools` package is not really necessary for this repository,
as it provides tools to build `.proto` files, but it is indirectly
providing the dependency to `protobuf`, which provides `google.protobuf`
and it's indeed used by this repository.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
We remove the `_helper` suffix, as it doesn't provide any information.
We also remove the `grpc_` prefix for `streaming` as we have that info
in the class name, and it also involves Frequenz channels, and the same
for the `_strategy` in `retry`.

In general it is also a good practice to keep module names short.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
@github-actions github-actions bot added 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.) labels Feb 29, 2024
Marenz
Marenz previously approved these changes Feb 29, 2024
Copy link
Contributor

@shsms shsms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment about the name.

src/frequenz/client/base/streaming.py Outdated Show resolved Hide resolved
src/frequenz/client/base/streaming.py Show resolved Hide resolved
@llucax
Copy link
Contributor Author

llucax commented Mar 1, 2024

I will update and improve the docs in a followup PR, and then do the v0.2.0 release.

@llucax llucax enabled auto-merge March 1, 2024 11:07
@llucax
Copy link
Contributor Author

llucax commented Mar 1, 2024

Enabled auto-merge.

@shsms
Copy link
Contributor

shsms commented Mar 1, 2024

do you want to update the commit message also? edab315

The `Helper` part doesn't provide any useful information, what is more
important about this class, is that it is using a `Broadcast` channel to
broadcast what's received by the gRPC stream.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
The `Retry` part is in the module name, so it is redundant. This also
change imports to use the module name, and change some variables to
`strategy` to make the code more clear (before the style was not very
consistent, sometimes calling variables `retry_spec` or just `retry`.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
@llucax
Copy link
Contributor Author

llucax commented Mar 1, 2024

Good catch, done now!

@shsms shsms disabled auto-merge March 1, 2024 11:32
@shsms shsms enabled auto-merge March 1, 2024 11:32
@shsms shsms added this pull request to the merge queue Mar 1, 2024
@shsms
Copy link
Contributor

shsms commented Mar 1, 2024

I updated the PR description also with the new name, and removed and re-enabled auto-merge, so that it uses the updated merge commit message.

Merged via the queue into frequenz-floss:v0.x.x with commit 28cbaab Mar 1, 2024
14 checks passed
@llucax llucax deleted the restructure branch March 1, 2024 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants