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

Add AsyncTyper class to the Python SDK #2453

Merged
merged 5 commits into from
Mar 4, 2024
Merged

Conversation

dgarros
Copy link
Collaborator

@dgarros dgarros commented Mar 2, 2024

Fixes #2354

This PR adds a new AsyncTyper class to the SDK and converts some infrahubctl commands that are using async to using this new version of Typer.

As @ogenstad suggested in slack, technically most infrahubctl commands could be converted to using the Sync client. The main reason I would like to have it in there is because the infrahub cli requires Async for most commands so it will be very useful there and to simplify the creation of other cli tools as well.

@github-actions github-actions bot added the type/documentation Improvements or additions to documentation label Mar 3, 2024
@@ -12,6 +11,7 @@
from rich.table import Table

from infrahub_sdk import Error, GraphQLError
from infrahub_sdk.async_typer import AsyncTyper
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reason why we don't want to have this under infrahub_sdk.ctl instead? Is the intention that the server components would also load the same class from this location?. To me it feels cleaner to have it under .ctl.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The goal is to have it available for other cli tools not just infrahubctl

@@ -205,6 +208,7 @@ ignore = [
"PLR0912", # Too many branches
"PLR0913", # Too many arguments in function definition
"PLR0917", # Too many positional arguments
"PLR2004", # Magic value used in comparison
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we actually have any violations that motivates adding this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes I'm seeing a lot of error when I run invoke sdk.format sdk.lint locally
After more investigation it looks like the command ruff check --fix python_sdk --config python_sdk/pyproject.toml doesn't respect the configuration file :/

@dgarros dgarros merged commit 7d0ab2c into develop Mar 4, 2024
41 checks passed
@dgarros dgarros deleted the dga-20240302-async-typer branch March 4, 2024 10:28
@dgarros dgarros added type/feature New feature or request and removed type/documentation Improvements or additions to documentation labels Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature: Add async support to Typer
2 participants