Skip to content

Commit ff4a8bc

Browse files
committed
clean up client.py
1 parent 78b179c commit ff4a8bc

4 files changed

Lines changed: 44 additions & 22 deletions

File tree

python/lib/sift_client/client.py

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from __future__ import annotations
22

3-
from typing import NamedTuple
4-
53
from sift_client.errors import _sift_client_experimental_warning
64
from sift_client.resources import (
75
AssetsAPI,
@@ -22,23 +20,11 @@
2220
WithGrpcClient,
2321
WithRestClient,
2422
)
23+
from sift_client.util.util import AsyncAPIs
2524

2625
_sift_client_experimental_warning()
2726

2827

29-
class AsyncAPIs(NamedTuple):
30-
"""Simple accessor for the asynchronous APIs, still uses the SiftClient instance."""
31-
32-
"""Instance of the Ping API for making asynchronous requests."""
33-
ping: PingAPIAsync
34-
"""Instance of the Assets API for making asynchronous requests."""
35-
assets: AssetsAPIAsync
36-
"""Instance of the Calculated Channels API for making asynchronous requests."""
37-
calculated_channels: CalculatedChannelsAPIAsync
38-
"""Instance of the Runs API for making asynchronous requests."""
39-
runs: RunsAPIAsync
40-
41-
4228
class SiftClient(
4329
WithGrpcClient,
4430
WithRestClient,
@@ -48,7 +34,7 @@ class SiftClient(
4834
4935
It provides both synchronous and asynchronous interfaces, strong type checking, and a Pythonic API design.
5036
51-
Example usage:
37+
Examples:
5238
from sift_client import SiftClient
5339
from datetime import datetime
5440
@@ -72,14 +58,21 @@ class SiftClient(
7258
response = await sift.async_.ping.ping()
7359
"""
7460

75-
"""Instance of the Ping API for making synchronous requests."""
61+
7662
ping: PingAPI
77-
"""Instance of the Assets API for making synchronous requests."""
63+
"""Instance of the Ping API for making synchronous requests."""
64+
7865
assets: AssetsAPI
79-
"""Instance of the Calculated Channels API for making synchronous requests."""
66+
"""Instance of the Assets API for making synchronous requests."""
67+
8068
calculated_channels: CalculatedChannelsAPI
81-
"""Instance of the Runs API for making synchronous requests."""
69+
"""Instance of the Calculated Channels API for making synchronous requests."""
70+
8271
runs: RunsAPI
72+
"""Instance of the Runs API for making synchronous requests."""
73+
74+
async_: AsyncAPIs
75+
"""Accessor for the asynchronous APIs. All asynchronous APIs are available as attributes on this accessor."""
8376

8477
def __init__(
8578
self,
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from __future__ import annotations
2+
3+
from typing import NamedTuple
4+
5+
from sift_client.resources import (
6+
AssetsAPIAsync,
7+
CalculatedChannelsAPIAsync,
8+
PingAPIAsync,
9+
RunsAPIAsync,
10+
)
11+
12+
13+
class AsyncAPIs(NamedTuple):
14+
"""Simple accessor for the asynchronous APIs, still uses the SiftClient instance."""
15+
16+
ping: PingAPIAsync
17+
"""Instance of the Ping API for making asynchronous requests."""
18+
19+
assets: AssetsAPIAsync
20+
"""Instance of the Assets API for making asynchronous requests."""
21+
22+
calculated_channels: CalculatedChannelsAPIAsync
23+
"""Instance of the Calculated Channels API for making asynchronous requests."""
24+
25+
runs: RunsAPIAsync
26+
"""Instance of the Runs API for making asynchronous requests."""

python/mkdocs.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ plugins:
3636
default_handler: python
3737
handlers:
3838
python:
39+
import:
40+
- https://docs.python.org/3/objects.inv
3941
options:
42+
show_docstring_examples: false
4043
load_external_modules: true
4144
show_source: false
4245
find_stubs_package: true
@@ -56,7 +59,7 @@ plugins:
5659
show_symbol_type_heading: true
5760
show_symbol_type_toc: true
5861
summary: true
59-
# Custom Griffe extension to only inspect sync_stubs
62+
# Custom Griffe extension to inspect the sync stubs and generate their signatures
6063
extensions:
6164
- griffe_extensions/sync_stubs_inspector.py:InspectSpecificObjects:
6265
paths:

python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ development = [
5555
"ruff",
5656
]
5757
build = ["pdoc==14.5.0", "build==1.2.1"]
58-
docs = ["mkdocs", "mkdocs-material", "mkdocstrings[python]", "mkdocs-include-markdown-plugin"]
58+
docs = ["mkdocs", "mkdocs-material", "mkdocstrings[python]", "mkdocs-include-markdown-plugin", "mkdocs-api-autonav"]
5959
openssl = ["pyOpenSSL<24.0.0", "types-pyOpenSSL<24.0.0", "cffi~=1.14"]
6060
tdms = ["npTDMS~=1.9"]
6161
rosbags = ["rosbags~=0.0"]

0 commit comments

Comments
 (0)