drukbox-python-sdk 0.0.4__tar.gz → 0.0.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: drukbox-python-sdk
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: Async Python client for Drukbox.
5
5
  Requires-Python: >=3.11
6
6
  Requires-Dist: httpx>=0.28
@@ -80,7 +80,7 @@ Supported host operations:
80
80
  - `aclose`
81
81
 
82
82
  `create_host` supports the service's optional `image`, `env`, `expires_at`,
83
- and `Idempotency-Key` inputs.
83
+ `provider`, and `Idempotency-Key` inputs.
84
84
 
85
85
  `doctor` fetches `GET /doctor` — read-only dependency health. The service
86
86
  runs one cheap, non-mutating probe per dependency (database, active VM
@@ -72,7 +72,7 @@ Supported host operations:
72
72
  - `aclose`
73
73
 
74
74
  `create_host` supports the service's optional `image`, `env`, `expires_at`,
75
- and `Idempotency-Key` inputs.
75
+ `provider`, and `Idempotency-Key` inputs.
76
76
 
77
77
  `doctor` fetches `GET /doctor` — read-only dependency health. The service
78
78
  runs one cheap, non-mutating probe per dependency (database, active VM
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "drukbox-python-sdk"
7
- version = "0.0.4"
7
+ version = "0.0.5"
8
8
  description = "Async Python client for Drukbox."
9
9
  readme = "README.md"
10
10
  # Tracks the lowest Python any current consumer supports. Bump only
@@ -214,6 +214,7 @@ class SandboxAPI:
214
214
  expires_at: datetime | None = None,
215
215
  idempotency_key: str | None = None,
216
216
  image: str | None = None,
217
+ provider: str | None = None,
217
218
  ) -> SandboxHost:
218
219
  """Provision a new host.
219
220
 
@@ -228,6 +229,10 @@ class SandboxAPI:
228
229
  header. Useful for retry safety on flaky networks — a retry with
229
230
  the same key after a successful provision returns the original
230
231
  host instead of creating a duplicate.
232
+
233
+ ``provider`` pins which VM provider serves the request; omit it to
234
+ use the service default. An unknown provider raises
235
+ :class:`SandboxResponseError` (the service rejects it with 400).
231
236
  """
232
237
 
233
238
  payload: dict[str, Any] = {}
@@ -237,6 +242,8 @@ class SandboxAPI:
237
242
  payload["expires_at"] = expires_at.isoformat()
238
243
  if image is not None:
239
244
  payload["image"] = image
245
+ if provider is not None:
246
+ payload["provider"] = provider
240
247
 
241
248
  headers: dict[str, str] = {}
242
249
  if idempotency_key is not None:
@@ -164,9 +164,23 @@ async def test_create_host_omits_image_and_env_when_unset(api: SandboxAPI):
164
164
  assert "image" not in body
165
165
  assert "env" not in body
166
166
  assert "expires_at" not in body
167
+ assert "provider" not in body
167
168
  assert "Idempotency-Key" not in route.calls.last.request.headers
168
169
 
169
170
 
171
+ @respx.mock
172
+ async def test_create_host_sends_provider_when_set(api: SandboxAPI):
173
+ payload = _host_payload(provider="hetzner")
174
+ route = respx.post(f"{BASE_URL}/hosts").mock(
175
+ return_value=httpx.Response(201, json=payload),
176
+ )
177
+
178
+ host = await api.create_host(provider="hetzner")
179
+
180
+ assert '"provider":"hetzner"' in route.calls.last.request.content.decode()
181
+ assert host.provider == "hetzner"
182
+
183
+
170
184
  @respx.mock
171
185
  async def test_get_host_returns_parsed_host(api: SandboxAPI):
172
186
  payload = _host_payload(status="active")