-
Couldn't load subscription status.
- Fork 6
ci: add api doc generation #481
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
base: stable
Are you sure you want to change the base?
Changes from 20 commits
d69b7f6
36610dd
89511ae
469bf19
9b881e8
c016809
1484494
1acb7b0
ff31be5
9d0a674
ce543b8
0619e37
f733340
d017fcf
0703af8
9f99440
ed095d2
fb08b5f
4980873
e101d9a
9f13b94
59a7645
cf30309
2321af2
a0a8686
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add support for automatic Python SDK API from docstrings in the code. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| --- | ||
| title: analyzer | ||
| sidebarTitle: analyzer | ||
| --- | ||
|
|
||
| # `infrahub_sdk.analyzer` | ||
|
|
||
| ## Classes | ||
|
|
||
| ### `GraphQLQueryVariable` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/analyzer.py#L20" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
||
|
|
||
| ### `GraphQLOperation` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/analyzer.py#L27" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ### `GraphQLQueryAnalyzer` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/analyzer.py#L32" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| **Methods:** | ||
|
|
||
| #### `is_valid` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/analyzer.py#L40" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ```python | ||
| is_valid(self) -> tuple[bool, list[GraphQLError] | None] | ||
| ``` | ||
|
|
||
| #### `nbr_queries` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/analyzer.py#L51" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ```python | ||
| nbr_queries(self) -> int | ||
| ``` | ||
|
|
||
| #### `operations` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/analyzer.py#L55" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ```python | ||
| operations(self) -> list[GraphQLOperation] | ||
| ``` | ||
|
|
||
| #### `contains_mutation` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/analyzer.py#L68" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ```python | ||
| contains_mutation(self) -> bool | ||
| ``` | ||
|
|
||
| #### `variables` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/analyzer.py#L72" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ```python | ||
| variables(self) -> list[GraphQLQueryVariable] | ||
| ``` | ||
|
|
||
| #### `calculate_depth` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/analyzer.py#L101" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ```python | ||
| calculate_depth(self) -> int | ||
| ``` | ||
|
|
||
| Number of nested levels in the query | ||
|
|
||
| #### `calculate_height` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/analyzer.py#L106" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ```python | ||
| calculate_height(self) -> int | ||
| ``` | ||
|
|
||
| Total number of fields requested in the query | ||
|
|
||
| #### `get_fields` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/analyzer.py#L111" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ```python | ||
| get_fields(self) -> dict[str, Any] | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| --- | ||
| title: async_typer | ||
| sidebarTitle: async_typer | ||
| --- | ||
|
|
||
| # `infrahub_sdk.async_typer` | ||
|
|
||
| ## Classes | ||
|
|
||
| ### `AsyncTyper` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/async_typer.py#L11" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| **Methods:** | ||
|
|
||
| #### `maybe_run_async` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/async_typer.py#L13" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ```python | ||
| maybe_run_async(decorator: Callable, func: Callable) -> Any | ||
| ``` | ||
|
|
||
| #### `callback` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/async_typer.py#L25" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ```python | ||
| callback(self, *args: Any, **kwargs: Any) -> Any | ||
| ``` | ||
|
|
||
| #### `command` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/async_typer.py#L29" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ```python | ||
| command(self, *args: Any, **kwargs: Any) -> Any | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| --- | ||
| title: batch | ||
| sidebarTitle: batch | ||
| --- | ||
|
|
||
| # `infrahub_sdk.batch` | ||
|
|
||
| ## Functions | ||
|
|
||
| ### `execute_batch_task_in_pool` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/batch.py#L41" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ```python | ||
| execute_batch_task_in_pool(task: BatchTask, semaphore: asyncio.Semaphore, return_exceptions: bool = False) -> tuple[InfrahubNode | None, Any] | ||
| ``` | ||
|
|
||
| ## Classes | ||
|
|
||
| ### `BatchTask` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/batch.py#L14" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ### `BatchTaskSync` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/batch.py#L22" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| **Methods:** | ||
|
|
||
| #### `execute` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/batch.py#L28" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ```python | ||
| execute(self, return_exceptions: bool = False) -> tuple[InfrahubNodeSync | None, Any] | ||
| ``` | ||
|
|
||
| Executes the stored task. | ||
|
|
||
| ### `InfrahubBatch` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/batch.py#L55" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| **Methods:** | ||
|
|
||
| #### `num_tasks` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/batch.py#L67" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ```python | ||
| num_tasks(self) -> int | ||
| ``` | ||
|
|
||
| #### `add` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/batch.py#L70" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ```python | ||
| add(self, *args: Any, **kwargs: Any) -> None | ||
| ``` | ||
|
|
||
| #### `execute` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/batch.py#L73" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ```python | ||
| execute(self) -> AsyncGenerator | ||
| ``` | ||
|
|
||
| ### `InfrahubBatchSync` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/batch.py#L92" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| **Methods:** | ||
|
|
||
| #### `num_tasks` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/batch.py#L99" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ```python | ||
| num_tasks(self) -> int | ||
| ``` | ||
|
|
||
| #### `add` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/batch.py#L102" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ```python | ||
| add(self, *args: Any, **kwargs: Any) -> None | ||
| ``` | ||
|
|
||
| #### `execute` <sup><a href="https://github.com/opsmill/infrahub-sdk-python/blob/main/infrahub_sdk/batch.py#L105" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup> | ||
|
|
||
| ```python | ||
| execute(self) -> Generator[tuple[InfrahubNodeSync | None, Any], None, None] | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add this as an invoke command too so that it's consistent with how we do it in other repos.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate a bit about which part here you'd add as an invoke command ?
For now, I added an invoke command to generate the API docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean that we can run
poetry run invoke generate-sdk-api-docsto generate the docs but then have another command to validate. It could simplify to also have a shortcut for the git diff like we have here:https://github.com/opsmill/infrahub/blob/infrahub-v1.3.4/tasks/backend.py#L176
This part isn't critical though just a suggestion.