Skip to content

Conversation

@llucax
Copy link
Contributor

@llucax llucax commented Nov 18, 2024

This change was intended to make building a client simpler, but it ended up being more complicated than expected, using the async stub is more complicated than expected, as it lives only in the .pyi file and can't be used in any other context than type hints. For example the new approach didn't worked well with delaying the connection of the client. To handle that correctly, more work is needed by subclasses.

This commit reverts to making the BaseApiClient class generic and it instantiates the stub internally as before. To get proper async type hints, users now only need to write the stub property themselves, and use the appropriate async stub type hint there.

The release notes are also cleared up because we plan to release v0.8.0 after this is merged.

This commit reverts commit 035a794.

@llucax llucax requested a review from a team as a code owner November 18, 2024 13:19
@llucax llucax requested a review from Marenz November 18, 2024 13:19
@github-actions github-actions bot added part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:code Affects the code in general labels Nov 18, 2024
@llucax llucax self-assigned this Nov 18, 2024
@llucax llucax added this to the v0.8.0 milestone Nov 18, 2024
@llucax llucax added the scope:breaking-change Breaking change, users will need to update their code label Nov 18, 2024
@llucax llucax enabled auto-merge November 18, 2024 13:37
@llucax llucax requested a review from shsms November 18, 2024 14:04
@llucax llucax disabled auto-merge November 18, 2024 14:14
This change was intended to make building a client simpler, but it ended
up being more complicated than expected, using the async stub is more
complicated than expected, as it lives only in the `.pyi` file and can't
be used in any other context than type hints. For example the new
approach didn't worked well with delaying the connection of the client.
To handle that correctly, more work is needed by subclasses.

This commit reverts back to making the `BaseApiClient` class generic and
it instantiates the stub internally as before. To get proper async type
hints, users now only need to write the `stub` property themselves, and
use the appropriate async stub type hint there.

This reverts commit 035a794.

Signed-off-by: Leandro Lucarella <[email protected]>
@llucax
Copy link
Contributor Author

llucax commented Nov 18, 2024

@llucax llucax added this pull request to the merge queue Nov 18, 2024
Merged via the queue into frequenz-floss:v0.x.x with commit f03d3e5 Nov 18, 2024
14 checks passed
@llucax llucax deleted the stub-back branch November 18, 2024 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:code Affects the code in general part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests scope:breaking-change Breaking change, users will need to update their code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants