drukbox-python-sdk 0.5.1__py3-none-any.whl → 0.6.0__py3-none-any.whl

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.5
2
2
  Name: drukbox-python-sdk
3
- Version: 0.5.1
3
+ Version: 0.6.0
4
4
  Summary: Async Python client for Drukbox.
5
5
  Project-URL: Homepage, https://github.com/clawhaven/drukbox-python-sdk
6
6
  Project-URL: Repository, https://github.com/clawhaven/drukbox-python-sdk
@@ -94,10 +94,11 @@ Supported host operations:
94
94
  - `aclose`
95
95
 
96
96
  `create_host` supports the service's optional `image`, `env`, `expires_at`,
97
- `permanent`, `provider`, `instance_type`, `disk_gb`, `template`, `secrets`,
98
- and `Idempotency-Key` inputs. `instance_type` (provider-native size, e.g.
97
+ `permanent`, `provider`, `instance_type`, `disk_gb`, `cpu`, `memory_gb`, `template`,
98
+ `secrets`, and `Idempotency-Key` inputs. `instance_type` (provider-native size, e.g.
99
99
  `t3.xlarge` / `cx33`) and `disk_gb` pin the VM shape; omit either for the
100
- provider default. Omit `expires_at` for the default lease, pass a datetime for
100
+ provider default. `cpu` (vCPUs) and `memory_gb` size the VM by what it needs, on a
101
+ provider that can. Omit `expires_at` for the default lease, pass a datetime for
101
102
  an explicit expiry, or pass `permanent=True` for a never-reaped host.
102
103
  `template` accepts a template ID. An explicit `image` wins over it.
103
104
 
@@ -157,8 +158,9 @@ Supported template operations:
157
158
  - `delete_template`
158
159
 
159
160
  `create_template` returns immediately with a `building` record. Poll
160
- `get_template` until the status is `available` or `failed`. A failed record
161
- carries the reason in `last_error`.
161
+ `get_template` until the status is `available` or `failed`. While it builds,
162
+ `build_step` names the step the build is in. A failed record keeps that step
163
+ and carries the reason in `last_error`.
162
164
 
163
165
  Supported HTTP-proxy operations:
164
166
 
@@ -0,0 +1,7 @@
1
+ drukbox_sdk/__init__.py,sha256=OgssAANGnl49_1N_EKMXSDlgWfedO9jUAnLVxgkJY2Q,1066
2
+ drukbox_sdk/api.py,sha256=ZoZku-VA_LF5b0w5O-XR_UbIduZJZjlPUJK2_YtWglU,25443
3
+ drukbox_sdk/exceptions.py,sha256=0CKbb0Ec4RSWPB8t31WJgO1yQQ10BwTPqoqS1_EieB4,2599
4
+ drukbox_python_sdk-0.6.0.dist-info/METADATA,sha256=NRUghQ4mL6cry0azETFKxn3PXkPLC04sFNBdZoRw76s,6920
5
+ drukbox_python_sdk-0.6.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
6
+ drukbox_python_sdk-0.6.0.dist-info/licenses/LICENSE,sha256=zM66rWL3BWGJBa_mZPnM0WUomSSZ1xtWVtGQovQ71M8,1078
7
+ drukbox_python_sdk-0.6.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.32.4
2
+ Generator: hatchling 1.33.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
drukbox_sdk/api.py CHANGED
@@ -163,9 +163,12 @@ class SandboxTemplate:
163
163
  """Snapshot of a reusable sandbox template as returned by the service.
164
164
 
165
165
  ``status`` moves from ``"building"`` to ``"available"`` or
166
- ``"failed"``. While the build runs, ``image`` is empty. A failed
167
- build carries its reason in ``last_error``. The record has no
168
- ``setup_script`` because the service never echoes it back.
166
+ ``"failed"``. While the build runs, ``image`` is empty and
167
+ ``build_step`` names the step the build is in. A failed build keeps
168
+ the step it failed in and carries its reason in ``last_error``.
169
+ ``build_step`` is empty from a service that does not send it. The
170
+ record has no ``setup_script`` because the service never echoes it
171
+ back.
169
172
  """
170
173
 
171
174
  id: str
@@ -179,6 +182,7 @@ class SandboxTemplate:
179
182
  created_at: str
180
183
  updated_at: str
181
184
  last_used_at: str | None
185
+ build_step: str = ""
182
186
 
183
187
 
184
188
  @dataclass(frozen=True)
@@ -292,12 +296,14 @@ class SandboxAPI:
292
296
  async def create_host(
293
297
  self,
294
298
  *,
299
+ cpu: int | None = None,
295
300
  disk_gb: int | None = None,
296
301
  env: dict[str, str] | None = None,
297
302
  expires_at: datetime | None = None,
298
303
  idempotency_key: str | None = None,
299
304
  image: str | None = None,
300
305
  instance_type: str | None = None,
306
+ memory_gb: int | None = None,
301
307
  permanent: bool = False,
302
308
  provider: str | None = None,
303
309
  secrets: dict[str, Secret | Issuer] | None = None,
@@ -332,6 +338,13 @@ class SandboxAPI:
332
338
  either to use the provider's configured default. A size the active
333
339
  provider can't serve raises :class:`SandboxResponseError` (400).
334
340
 
341
+ ``cpu`` (vCPUs) and ``memory_gb`` size the VM by what it needs, not by a
342
+ provider's name for it; omit either to use the provider's default. A
343
+ provider that can't size a VM this way raises
344
+ :class:`SandboxResponseError` (400). A size the provider's account
345
+ does not allow fails the host: it goes to ``"error"`` with the reason
346
+ in ``last_error``.
347
+
335
348
  Lease: omit ``expires_at`` for the service's default lease, pass a
336
349
  ``datetime`` for an explicit expiry, or pass ``permanent=True`` for
337
350
  a host the janitor never reaps.
@@ -344,6 +357,8 @@ class SandboxAPI:
344
357
  raise ValueError("a permanent host cannot carry an expires_at")
345
358
 
346
359
  payload: dict[str, Any] = {}
360
+ if cpu is not None:
361
+ payload["cpu"] = cpu
347
362
  if disk_gb is not None:
348
363
  payload["disk_gb"] = disk_gb
349
364
  if env is not None:
@@ -357,6 +372,8 @@ class SandboxAPI:
357
372
  payload["image"] = image
358
373
  if instance_type is not None:
359
374
  payload["instance_type"] = instance_type
375
+ if memory_gb is not None:
376
+ payload["memory_gb"] = memory_gb
360
377
  if provider is not None:
361
378
  payload["provider"] = provider
362
379
  if secrets:
@@ -1,7 +0,0 @@
1
- drukbox_sdk/__init__.py,sha256=OgssAANGnl49_1N_EKMXSDlgWfedO9jUAnLVxgkJY2Q,1066
2
- drukbox_sdk/api.py,sha256=a3OJesAmWqOgbwKk6gOkgQgYUFpbCc_zlk6JiiVd1MI,24659
3
- drukbox_sdk/exceptions.py,sha256=0CKbb0Ec4RSWPB8t31WJgO1yQQ10BwTPqoqS1_EieB4,2599
4
- drukbox_python_sdk-0.5.1.dist-info/METADATA,sha256=qIkn25Kdm1OU_lLzw-KdyIcF9K_FMZedVNha0D44Fws,6734
5
- drukbox_python_sdk-0.5.1.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
6
- drukbox_python_sdk-0.5.1.dist-info/licenses/LICENSE,sha256=zM66rWL3BWGJBa_mZPnM0WUomSSZ1xtWVtGQovQ71M8,1078
7
- drukbox_python_sdk-0.5.1.dist-info/RECORD,,