Skip to content

Commit 103ef77

Browse files
feat: add Python SDK WebSocket primitives
Stainless-Generated-From: 059581f48b1b88970d24a65b8f97774566fc34c6
1 parent caf7196 commit 103ef77

14 files changed

Lines changed: 496 additions & 1 deletion

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 61
1+
configured_endpoints: 62

api.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,26 @@ Methods:
1616

1717
- <code title="get /health">client.health.<a href="./src/hypeman/resources/health.py">check</a>() -> <a href="./src/hypeman/types/health_check_response.py">HealthCheckResponse</a></code>
1818

19+
# Capabilities
20+
21+
Types:
22+
23+
```python
24+
from hypeman.types import (
25+
Capabilities,
26+
CapabilitiesDefaultRuntime,
27+
CapabilitiesHost,
28+
CapabilitiesImages,
29+
CapabilitiesNetwork,
30+
CapabilitiesRuntime,
31+
CapabilitiesServer,
32+
)
33+
```
34+
35+
Methods:
36+
37+
- <code title="get /capabilities">client.capabilities.<a href="./src/hypeman/resources/capabilities.py">get</a>() -> <a href="./src/hypeman/types/capabilities.py">Capabilities</a></code>
38+
1939
# Images
2040

2141
Types:

src/hypeman/_client.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
instances,
4848
resources,
4949
snapshots,
50+
capabilities,
5051
)
5152
from .resources.builds import BuildsResource, AsyncBuildsResource
5253
from .resources.health import HealthResource, AsyncHealthResource
@@ -58,6 +59,7 @@
5859
from .resources.ingresses import IngressesResource, AsyncIngressesResource
5960
from .resources.resources import ResourcesResource, AsyncResourcesResource
6061
from .resources.snapshots import SnapshotsResource, AsyncSnapshotsResource
62+
from .resources.capabilities import CapabilitiesResource, AsyncCapabilitiesResource
6163
from .resources.instances.instances import InstancesResource, AsyncInstancesResource
6264

6365
__all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Hypeman", "AsyncHypeman", "Client", "AsyncClient"]
@@ -133,6 +135,12 @@ def health(self) -> HealthResource:
133135

134136
return HealthResource(self)
135137

138+
@cached_property
139+
def capabilities(self) -> CapabilitiesResource:
140+
from .resources.capabilities import CapabilitiesResource
141+
142+
return CapabilitiesResource(self)
143+
136144
@cached_property
137145
def images(self) -> ImagesResource:
138146
from .resources.images import ImagesResource
@@ -376,6 +384,12 @@ def health(self) -> AsyncHealthResource:
376384

377385
return AsyncHealthResource(self)
378386

387+
@cached_property
388+
def capabilities(self) -> AsyncCapabilitiesResource:
389+
from .resources.capabilities import AsyncCapabilitiesResource
390+
391+
return AsyncCapabilitiesResource(self)
392+
379393
@cached_property
380394
def images(self) -> AsyncImagesResource:
381395
from .resources.images import AsyncImagesResource
@@ -561,6 +575,12 @@ def health(self) -> health.HealthResourceWithRawResponse:
561575

562576
return HealthResourceWithRawResponse(self._client.health)
563577

578+
@cached_property
579+
def capabilities(self) -> capabilities.CapabilitiesResourceWithRawResponse:
580+
from .resources.capabilities import CapabilitiesResourceWithRawResponse
581+
582+
return CapabilitiesResourceWithRawResponse(self._client.capabilities)
583+
564584
@cached_property
565585
def images(self) -> images.ImagesResourceWithRawResponse:
566586
from .resources.images import ImagesResourceWithRawResponse
@@ -634,6 +654,12 @@ def health(self) -> health.AsyncHealthResourceWithRawResponse:
634654

635655
return AsyncHealthResourceWithRawResponse(self._client.health)
636656

657+
@cached_property
658+
def capabilities(self) -> capabilities.AsyncCapabilitiesResourceWithRawResponse:
659+
from .resources.capabilities import AsyncCapabilitiesResourceWithRawResponse
660+
661+
return AsyncCapabilitiesResourceWithRawResponse(self._client.capabilities)
662+
637663
@cached_property
638664
def images(self) -> images.AsyncImagesResourceWithRawResponse:
639665
from .resources.images import AsyncImagesResourceWithRawResponse
@@ -707,6 +733,12 @@ def health(self) -> health.HealthResourceWithStreamingResponse:
707733

708734
return HealthResourceWithStreamingResponse(self._client.health)
709735

736+
@cached_property
737+
def capabilities(self) -> capabilities.CapabilitiesResourceWithStreamingResponse:
738+
from .resources.capabilities import CapabilitiesResourceWithStreamingResponse
739+
740+
return CapabilitiesResourceWithStreamingResponse(self._client.capabilities)
741+
710742
@cached_property
711743
def images(self) -> images.ImagesResourceWithStreamingResponse:
712744
from .resources.images import ImagesResourceWithStreamingResponse
@@ -780,6 +812,12 @@ def health(self) -> health.AsyncHealthResourceWithStreamingResponse:
780812

781813
return AsyncHealthResourceWithStreamingResponse(self._client.health)
782814

815+
@cached_property
816+
def capabilities(self) -> capabilities.AsyncCapabilitiesResourceWithStreamingResponse:
817+
from .resources.capabilities import AsyncCapabilitiesResourceWithStreamingResponse
818+
819+
return AsyncCapabilitiesResourceWithStreamingResponse(self._client.capabilities)
820+
783821
@cached_property
784822
def images(self) -> images.AsyncImagesResourceWithStreamingResponse:
785823
from .resources.images import AsyncImagesResourceWithStreamingResponse

src/hypeman/resources/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@
8888
SnapshotsResourceWithStreamingResponse,
8989
AsyncSnapshotsResourceWithStreamingResponse,
9090
)
91+
from .capabilities import (
92+
CapabilitiesResource,
93+
AsyncCapabilitiesResource,
94+
CapabilitiesResourceWithRawResponse,
95+
AsyncCapabilitiesResourceWithRawResponse,
96+
CapabilitiesResourceWithStreamingResponse,
97+
AsyncCapabilitiesResourceWithStreamingResponse,
98+
)
9199

92100
__all__ = [
93101
"HealthResource",
@@ -96,6 +104,12 @@
96104
"AsyncHealthResourceWithRawResponse",
97105
"HealthResourceWithStreamingResponse",
98106
"AsyncHealthResourceWithStreamingResponse",
107+
"CapabilitiesResource",
108+
"AsyncCapabilitiesResource",
109+
"CapabilitiesResourceWithRawResponse",
110+
"AsyncCapabilitiesResourceWithRawResponse",
111+
"CapabilitiesResourceWithStreamingResponse",
112+
"AsyncCapabilitiesResourceWithStreamingResponse",
99113
"ImagesResource",
100114
"AsyncImagesResource",
101115
"ImagesResourceWithRawResponse",
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
import httpx
6+
7+
from .._types import Body, Query, Headers, NotGiven, not_given
8+
from .._compat import cached_property
9+
from .._resource import SyncAPIResource, AsyncAPIResource
10+
from .._response import (
11+
to_raw_response_wrapper,
12+
to_streamed_response_wrapper,
13+
async_to_raw_response_wrapper,
14+
async_to_streamed_response_wrapper,
15+
)
16+
from .._base_client import make_request_options
17+
from ..types.capabilities import Capabilities
18+
19+
__all__ = ["CapabilitiesResource", "AsyncCapabilitiesResource"]
20+
21+
22+
class CapabilitiesResource(SyncAPIResource):
23+
@cached_property
24+
def with_raw_response(self) -> CapabilitiesResourceWithRawResponse:
25+
"""
26+
This property can be used as a prefix for any HTTP method call to return
27+
the raw response object instead of the parsed content.
28+
29+
For more information, see https://www.github.com/kernel/hypeman-python#accessing-raw-response-data-eg-headers
30+
"""
31+
return CapabilitiesResourceWithRawResponse(self)
32+
33+
@cached_property
34+
def with_streaming_response(self) -> CapabilitiesResourceWithStreamingResponse:
35+
"""
36+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
37+
38+
For more information, see https://www.github.com/kernel/hypeman-python#with_streaming_response
39+
"""
40+
return CapabilitiesResourceWithStreamingResponse(self)
41+
42+
def get(
43+
self,
44+
*,
45+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
46+
# The extra values given here take precedence over values defined on the client or passed to this method.
47+
extra_headers: Headers | None = None,
48+
extra_query: Query | None = None,
49+
extra_body: Body | None = None,
50+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
51+
) -> Capabilities:
52+
"""
53+
Returns machine-readable host capabilities: server and API version, host
54+
OS/architecture, every runtime available on this host with its per-runtime
55+
feature IDs, the configured default runtime and whether it is available, guest
56+
networking model and host gateway, supported image platforms, and stable
57+
server-level feature IDs.
58+
59+
Runtime-derived values reflect the actual host (for example, snapshot and
60+
standby support on macOS is gated on the host OS version), so clients can gate
61+
behavior on capabilities without hard-coding hypervisor knowledge.
62+
"""
63+
return self._get(
64+
"/capabilities",
65+
options=make_request_options(
66+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
67+
),
68+
cast_to=Capabilities,
69+
)
70+
71+
72+
class AsyncCapabilitiesResource(AsyncAPIResource):
73+
@cached_property
74+
def with_raw_response(self) -> AsyncCapabilitiesResourceWithRawResponse:
75+
"""
76+
This property can be used as a prefix for any HTTP method call to return
77+
the raw response object instead of the parsed content.
78+
79+
For more information, see https://www.github.com/kernel/hypeman-python#accessing-raw-response-data-eg-headers
80+
"""
81+
return AsyncCapabilitiesResourceWithRawResponse(self)
82+
83+
@cached_property
84+
def with_streaming_response(self) -> AsyncCapabilitiesResourceWithStreamingResponse:
85+
"""
86+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
87+
88+
For more information, see https://www.github.com/kernel/hypeman-python#with_streaming_response
89+
"""
90+
return AsyncCapabilitiesResourceWithStreamingResponse(self)
91+
92+
async def get(
93+
self,
94+
*,
95+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
96+
# The extra values given here take precedence over values defined on the client or passed to this method.
97+
extra_headers: Headers | None = None,
98+
extra_query: Query | None = None,
99+
extra_body: Body | None = None,
100+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
101+
) -> Capabilities:
102+
"""
103+
Returns machine-readable host capabilities: server and API version, host
104+
OS/architecture, every runtime available on this host with its per-runtime
105+
feature IDs, the configured default runtime and whether it is available, guest
106+
networking model and host gateway, supported image platforms, and stable
107+
server-level feature IDs.
108+
109+
Runtime-derived values reflect the actual host (for example, snapshot and
110+
standby support on macOS is gated on the host OS version), so clients can gate
111+
behavior on capabilities without hard-coding hypervisor knowledge.
112+
"""
113+
return await self._get(
114+
"/capabilities",
115+
options=make_request_options(
116+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
117+
),
118+
cast_to=Capabilities,
119+
)
120+
121+
122+
class CapabilitiesResourceWithRawResponse:
123+
def __init__(self, capabilities: CapabilitiesResource) -> None:
124+
self._capabilities = capabilities
125+
126+
self.get = to_raw_response_wrapper(
127+
capabilities.get,
128+
)
129+
130+
131+
class AsyncCapabilitiesResourceWithRawResponse:
132+
def __init__(self, capabilities: AsyncCapabilitiesResource) -> None:
133+
self._capabilities = capabilities
134+
135+
self.get = async_to_raw_response_wrapper(
136+
capabilities.get,
137+
)
138+
139+
140+
class CapabilitiesResourceWithStreamingResponse:
141+
def __init__(self, capabilities: CapabilitiesResource) -> None:
142+
self._capabilities = capabilities
143+
144+
self.get = to_streamed_response_wrapper(
145+
capabilities.get,
146+
)
147+
148+
149+
class AsyncCapabilitiesResourceWithStreamingResponse:
150+
def __init__(self, capabilities: AsyncCapabilitiesResource) -> None:
151+
self._capabilities = capabilities
152+
153+
self.get = async_to_streamed_response_wrapper(
154+
capabilities.get,
155+
)

src/hypeman/types/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from .gpu_profile import GPUProfile as GPUProfile
2020
from .push_status import PushStatus as PushStatus
2121
from .build_status import BuildStatus as BuildStatus
22+
from .capabilities import Capabilities as Capabilities
2223
from .health_check import HealthCheck as HealthCheck
2324
from .ingress_rule import IngressRule as IngressRule
2425
from .volume_mount import VolumeMount as VolumeMount
@@ -36,6 +37,7 @@
3637
from .build_provenance import BuildProvenance as BuildProvenance
3738
from .health_check_tcp import HealthCheckTcp as HealthCheckTcp
3839
from .build_list_params import BuildListParams as BuildListParams
40+
from .capabilities_host import CapabilitiesHost as CapabilitiesHost
3941
from .health_check_exec import HealthCheckExec as HealthCheckExec
4042
from .health_check_http import HealthCheckHTTP as HealthCheckHTTP
4143
from .image_list_params import ImageListParams as ImageListParams
@@ -55,12 +57,16 @@
5557
from .build_events_params import BuildEventsParams as BuildEventsParams
5658
from .build_list_response import BuildListResponse as BuildListResponse
5759
from .builder_list_params import BuilderListParams as BuilderListParams
60+
from .capabilities_images import CapabilitiesImages as CapabilitiesImages
61+
from .capabilities_server import CapabilitiesServer as CapabilitiesServer
5862
from .gpu_resource_status import GPUResourceStatus as GPUResourceStatus
5963
from .image_create_params import ImageCreateParams as ImageCreateParams
6064
from .image_list_response import ImageListResponse as ImageListResponse
6165
from .ingress_list_params import IngressListParams as IngressListParams
6266
from .ingress_match_param import IngressMatchParam as IngressMatchParam
6367
from .resource_allocation import ResourceAllocation as ResourceAllocation
68+
from .capabilities_network import CapabilitiesNetwork as CapabilitiesNetwork
69+
from .capabilities_runtime import CapabilitiesRuntime as CapabilitiesRuntime
6470
from .device_create_params import DeviceCreateParams as DeviceCreateParams
6571
from .device_list_response import DeviceListResponse as DeviceListResponse
6672
from .ingress_target_param import IngressTargetParam as IngressTargetParam
@@ -97,6 +103,7 @@
97103
from .wait_for_state_response import WaitForStateResponse as WaitForStateResponse
98104
from .auto_standby_policy_param import AutoStandbyPolicyParam as AutoStandbyPolicyParam
99105
from .snapshot_schedule_retention import SnapshotScheduleRetention as SnapshotScheduleRetention
106+
from .capabilities_default_runtime import CapabilitiesDefaultRuntime as CapabilitiesDefaultRuntime
100107
from .device_list_available_response import DeviceListAvailableResponse as DeviceListAvailableResponse
101108
from .resource_reclaim_memory_params import ResourceReclaimMemoryParams as ResourceReclaimMemoryParams
102109
from .snapshot_schedule_retention_param import SnapshotScheduleRetentionParam as SnapshotScheduleRetentionParam

src/hypeman/types/capabilities.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List
4+
5+
from .._models import BaseModel
6+
from .capabilities_host import CapabilitiesHost
7+
from .capabilities_images import CapabilitiesImages
8+
from .capabilities_server import CapabilitiesServer
9+
from .capabilities_network import CapabilitiesNetwork
10+
from .capabilities_runtime import CapabilitiesRuntime
11+
from .capabilities_default_runtime import CapabilitiesDefaultRuntime
12+
13+
__all__ = ["Capabilities"]
14+
15+
16+
class Capabilities(BaseModel):
17+
default_runtime: CapabilitiesDefaultRuntime
18+
19+
features: List[str]
20+
"""
21+
Stable server-level feature IDs: API surfaces this server exposes regardless of
22+
which runtime backs an instance. Always present: "instances", "images",
23+
"builds", "volumes", "ingress", "exec", "logs". Host-conditional: "devices"
24+
(device passthrough management, Linux hosts only) and "rosetta-emulation" (Apple
25+
Silicon macOS hosts with Rosetta currently installed, per the same availability
26+
probe launches enforce). Per-runtime features are reported under each runtimes[]
27+
entry.
28+
"""
29+
30+
host: CapabilitiesHost
31+
32+
images: CapabilitiesImages
33+
34+
network: CapabilitiesNetwork
35+
36+
runtimes: List[CapabilitiesRuntime]
37+
"""
38+
Every runtime this server build supports on this host platform, each with its
39+
own availability flag and feature IDs. Hosts commonly support several runtimes
40+
at once (for example cloud-hypervisor, firecracker, qemu, and qemu-microvm on
41+
linux/amd64). A listed runtime is only launchable when its "available" flag is
42+
true. Entries are sorted by name.
43+
"""
44+
45+
server: CapabilitiesServer

0 commit comments

Comments
 (0)