wherobots-python-sdk 0.7.0__tar.gz → 0.8.0__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.
Files changed (60) hide show
  1. {wherobots_python_sdk-0.7.0/wherobots_python_sdk.egg-info → wherobots_python_sdk-0.8.0}/PKG-INFO +62 -61
  2. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/README.md +61 -60
  3. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/pyproject.toml +10 -0
  4. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/tests/test_api.py +72 -42
  5. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/tests/test_base_client.py +91 -160
  6. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/tests/test_client.py +241 -75
  7. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/tests/test_config.py +2 -2
  8. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/tests/test_enums.py +3 -2
  9. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/tests/test_files_api.py +46 -54
  10. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/tests/test_files_drive.py +62 -59
  11. wherobots_python_sdk-0.8.0/tests/test_live_contract.py +64 -0
  12. wherobots_python_sdk-0.8.0/tests/test_models.py +271 -0
  13. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/tests/test_regressions.py +12 -75
  14. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/tests/test_security.py +48 -129
  15. wherobots_python_sdk-0.8.0/tests/test_spec_contract.py +80 -0
  16. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/tests/test_tasks.py +31 -24
  17. wherobots_python_sdk-0.8.0/tests/test_wire.py +149 -0
  18. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots/__version__.py +1 -1
  19. wherobots_python_sdk-0.8.0/wherobots/_wire.py +212 -0
  20. wherobots_python_sdk-0.8.0/wherobots/api/_operations.py +317 -0
  21. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots/api/base.py +49 -79
  22. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots/api/drive.py +59 -53
  23. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots/api/files.py +17 -37
  24. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots/api/runs.py +55 -93
  25. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots/api/tasks.py +27 -48
  26. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots/client.py +157 -168
  27. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots/config.py +13 -12
  28. wherobots_python_sdk-0.8.0/wherobots/enums/__init__.py +43 -0
  29. wherobots_python_sdk-0.8.0/wherobots/enums/_generated.py +154 -0
  30. wherobots_python_sdk-0.8.0/wherobots/enums/_handwritten.py +103 -0
  31. wherobots_python_sdk-0.8.0/wherobots/models/__init__.py +106 -0
  32. wherobots_python_sdk-0.8.0/wherobots/models/_generated.py +790 -0
  33. wherobots_python_sdk-0.8.0/wherobots/models/_handwritten.py +355 -0
  34. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0/wherobots_python_sdk.egg-info}/PKG-INFO +62 -61
  35. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots_python_sdk.egg-info/SOURCES.txt +11 -2
  36. wherobots_python_sdk-0.7.0/tests/test_models.py +0 -1043
  37. wherobots_python_sdk-0.7.0/wherobots/enums.py +0 -183
  38. wherobots_python_sdk-0.7.0/wherobots/models.py +0 -1820
  39. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/LICENSE +0 -0
  40. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/setup.cfg +0 -0
  41. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/tests/test_client_header.py +0 -0
  42. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/tests/test_exceptions.py +0 -0
  43. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/tests/test_init_exports.py +0 -0
  44. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/tests/test_integration.py +0 -0
  45. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/tests/test_logger.py +0 -0
  46. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/tests/test_utils.py +0 -0
  47. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/tests/test_workload_auth.py +0 -0
  48. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots/__init__.py +0 -0
  49. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots/api/__init__.py +0 -0
  50. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots/api/workload_auth.py +0 -0
  51. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots/exceptions.py +0 -0
  52. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots/py.typed +0 -0
  53. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots/sdk.py +0 -0
  54. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots/utils/__init__.py +0 -0
  55. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots/utils/client_header.py +0 -0
  56. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots/utils/logger.py +0 -0
  57. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots/utils/validation.py +0 -0
  58. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots_python_sdk.egg-info/dependency_links.txt +0 -0
  59. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots_python_sdk.egg-info/requires.txt +0 -0
  60. {wherobots_python_sdk-0.7.0 → wherobots_python_sdk-0.8.0}/wherobots_python_sdk.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wherobots-python-sdk
3
- Version: 0.7.0
3
+ Version: 0.8.0
4
4
  Summary: Python SDK for Wherobots (currently covers the Jobs REST API)
5
5
  Author-email: Wherobots <support@wherobots.com>
6
6
  License-Expression: Apache-2.0
@@ -39,7 +39,7 @@ Additional Wherobots surfaces will be added over time.
39
39
  ## Features
40
40
 
41
41
  - Submit Python scripts or JARs as Wherobots jobs
42
- - Auto-upload local scripts via presigned URLs (only needs an API key)
42
+ - Auto-upload local scripts to Wherobots managed storage (only needs an API key)
43
43
  - Stream or iterate logs with pagination
44
44
  - List runs with status, name, and date filters
45
45
  - Typed dataclass models for all API responses (no pydantic dependency)
@@ -61,7 +61,7 @@ The simplest way to run a local script — only an API key is needed:
61
61
  from wherobots import WherobotsJob
62
62
 
63
63
  job = WherobotsJob(
64
- script="my_analysis.py", # local file — auto-uploaded via presigned URL
64
+ script="my_analysis.py", # local file — auto-uploaded to managed storage
65
65
  name="analysis-job-001",
66
66
  runtime="tiny",
67
67
  region="aws-us-west-2",
@@ -88,8 +88,7 @@ job = WherobotsJob(
88
88
  ### Script Upload Behavior
89
89
 
90
90
  When `script` is a local file path (not an `s3://` URI) and `auto_upload=True`
91
- (the default), the SDK uploads your script via a presigned S3 URL to Wherobots
92
- managed storage. Only needs a valid API key — no AWS credentials required.
91
+ (the default), the SDK uploads your script to Wherobots managed storage. Only needs a valid API key — no AWS credentials required.
93
92
 
94
93
  You can also reference scripts already in a
95
94
  [Storage Integration](https://docs.wherobots.com/latest/develop/storage-management/storage/)
@@ -135,7 +134,7 @@ job = WherobotsJob(script="s3://bucket/script.py", name="my-job-001")
135
134
  | `WHEROBOTS_API_KEY` | API key | *(required outside Wherobots)* |
136
135
  | `WHEROBOTS_REGION` | Region override (else org default) | *(none — org default)* |
137
136
  | `WHEROBOTS_API_BASE_URL` | API base URL | `https://api.cloud.wherobots.com` |
138
- | `WHEROBOTS_VERSION` | Wherobots version | `latest` |
137
+ | `WHEROBOTS_VERSION` | Runtime version | *(none, the org preset decides)* |
139
138
  | `WHEROBOTS_REQUEST_TIMEOUT_SECONDS`| HTTP request timeout (seconds) | `30` |
140
139
  | `WHEROBOTS_CLIENT_CHAIN` | Upstream client-attribution chain (see below) | *(none)* |
141
140
  | `WHEROBOTS_ID_TOKEN_PATH` | Workload identity token, set by Wherobots notebooks and jobs | *(none)* |
@@ -166,7 +165,7 @@ config = WherobotsConfig(
166
165
  | `api_key` | `str \| None` | `None` (read from env) |
167
166
  | `region` | `str \| None` | `None` |
168
167
  | `base_url` | `str` | `"https://api.cloud.wherobots.com"` |
169
- | `version` | `str` | `"latest"` |
168
+ | `version` | `str \| None` | `None` (org preset) |
170
169
  | `request_timeout_seconds` | `int` | `30` |
171
170
  | `client_chain` | `str \| None` | `None` |
172
171
 
@@ -213,11 +212,11 @@ WherobotsJob(
213
212
  runtime: str | Runtime | None = None, # Compute size (None -> org default)
214
213
  region: str | Region | None = None, # Region; str passed as-is (None -> org default)
215
214
  api_key: str | None = None, # API key (or env var)
216
- version: str | None = None, # "latest" | "preview"
215
+ version: str | None = None, # "latest" | "preview" (None -> org preset)
217
216
  timeout_seconds: int = 3600, # Job timeout
218
217
  args: list[str] | None = None, # Script arguments
219
218
  spark_configs: dict[str, str] | None = None, # Spark config overrides
220
- dependencies: list[dict] | None = None, # PyPI or file dependencies
219
+ dependencies: list[PyPiDependency | FileDependency] | None = None,
221
220
  spark_driver_disk_gb: int | None = None, # Driver disk size (GB)
222
221
  spark_executor_disk_gb: int | None = None, # Executor disk size (GB)
223
222
  jar_main_class: str | None = None, # Main class (required for JARs)
@@ -235,14 +234,14 @@ WherobotsJob(
235
234
  |--------|---------|-------------|
236
235
  | `submit()` | `str` | Submit the job. Returns the run ID. Idempotent (returns existing ID if already submitted). |
237
236
  | `get_status()` | `RunView` | Get current job status and full details. |
238
- | `get_logs(cursor=0, size=100)` | `LogsResponse` | Fetch a page of log entries. |
237
+ | `get_logs(cursor=None, size=100)` | `LogsResponse` | Fetch a page of log entries. The cursor is an opaque string from `next_page`. |
239
238
  | `get_metrics()` | `RunMetricsResponse` | Fetch CPU/memory metrics for the run. |
240
239
  | `get_cpu_utilization()` | `UtilizationStats` | Aggregated CPU utilization (`latest`, `max`, `avg`, `series`). |
241
240
  | `get_mem_utilization()` | `UtilizationStats` | Aggregated memory utilization (`latest`, `max`, `avg`, `series`). |
242
241
  | `get_cost()` | `float \| None` | Total run cost in USD, or `None` if not yet billed. |
243
242
  | `get_consumed_spatial_units()` | `float \| None` | Spatial Units (SUs) consumed by the run. |
244
243
  | `refresh()` | `RunView` | Re-fetch from the API and update `status`/`name`/`runtime`/`region`/`version` in place. |
245
- | `iter_logs(cursor=0, size=100)` | `Iterator[dict]` | Iterate over all log entries, handling pagination automatically. |
244
+ | `iter_logs(cursor=None, size=100)` | `Iterator[dict]` | Iterate over all log entries, handling pagination automatically. |
246
245
  | `poll_for_logs(follow=True, interval=2.0, log_handler=None, max_errors=10)` | `None` | Poll and print logs. If `follow=True`, continues until job completes. `max_errors` sets the max consecutive transient errors before giving up. |
247
246
  | `cancel()` | `bool` | Request cancellation. Returns `True` on success. |
248
247
  | `wait_for_completion(poll_interval=5.0, stream_logs=True, log_interval=2.0, max_wait_seconds=None)` | `JobStatus` | Block until the job reaches a terminal state. Set `max_wait_seconds` to limit wait time (raises `WherobotsTimeoutError`). |
@@ -269,8 +268,8 @@ with WherobotsJob(script="s3://bucket/script.py", name="my-job") as job:
269
268
  |--------|---------|-------------|
270
269
  | `from_run_id(run_id, api_key=None, ...)` | `WherobotsJob` | Attach to an existing run for read-only log/metric access. No script required. `submit()` is disabled on the returned instance. |
271
270
  | `list_runs(...)` | `RunListPage` | List runs with optional filters. No instance required. |
272
- | `add_pypi_dependency(name, version)` | `dict` | Create a PyPI dependency dict for the `dependencies` parameter. |
273
- | `add_file_dependency(file_path)` | `dict` | Create a file dependency dict (`.jar`, `.whl`, `.zip`, `.json`). Accepts an `s3://` URI or a local path — local paths are auto-uploaded to **managed storage** at `submit()` time. For non-managed destinations, upload via `FilesAPI` first and pass the resulting `s3://` URI. |
271
+ | `add_pypi_dependency(library_name, library_version=None)` | `PyPiDependency` | Create a PyPI dependency for the `dependencies` parameter. |
272
+ | `add_file_dependency(file_path)` | `FileDependency` | Create a file dependency (`.jar`, `.whl`, `.zip`, `.json`). Accepts an `s3://` URI or a local path — local paths are auto-uploaded to **managed storage** at `submit()` time. For non-managed destinations, upload via `FilesAPI` first and pass the resulting `s3://` URI. |
274
273
 
275
274
  #### Attaching to an Existing Run
276
275
 
@@ -598,77 +597,79 @@ job = WherobotsJob(
598
597
 
599
598
  ## Models
600
599
 
601
- All models are Python dataclasses with `from_dict()` and `to_dict()` methods
602
- for JSON round-tripping.
600
+ Models are generated from the Wherobots OpenAPI spec. They are frozen dataclasses built with
601
+ keyword arguments, with `from_dict()` and `to_dict()` for the API's JSON. A missing required field
602
+ or a wrong type raises `WherobotsAPIError`. Unknown fields are ignored, and an enum value newer than
603
+ the SDK still decodes, so `status.value` works for it.
603
604
 
604
605
  ### RunView
605
606
 
606
607
  Returned by `get_status()` and `list_runs()`. Represents a single job run.
607
608
 
608
- | Field | Type | Description |
609
- |--------------------|---------------------------|--------------------------------|
610
- | `id` | `str` | Run ID |
611
- | `name` | `str` | Job name |
612
- | `status` | `JobStatus \| None` | Current status |
613
- | `runtime` | `str \| None` | Compute runtime size |
614
- | `region` | `str \| None` | AWS region |
615
- | `version` | `str \| None` | Wherobots version |
616
- | `timeout_seconds` | `int \| None` | Job timeout |
617
- | `create_time` | `str \| None` | ISO-8601 creation timestamp |
618
- | `update_time` | `str \| None` | ISO-8601 last update timestamp |
619
- | `start_time` | `str \| None` | ISO-8601 start timestamp |
620
- | `complete_time` | `str \| None` | ISO-8601 completion timestamp |
621
- | `run_python` | `RunPythonPayload \| None`| Python script payload |
622
- | `run_jar` | `RunJarPayload \| None` | JAR payload |
623
- | `environment` | `RunEnvironment \| None` | Spark config & dependencies |
624
- | `triggered_by` | `dict \| None` | User who triggered the run |
625
- | `kube_app` | `RunKubeApp \| None` | Kubernetes app details |
626
- | `app_meta` | `RunAppMeta \| None` | Spark/Sedona UI URLs |
627
- | `organization` | `OrganizationCustomer \| None` | Org info |
628
- | `extra` | `dict` | Any additional API fields |
609
+ | Field | Type | Description |
610
+ |-------------------|----------------------------|--------------------------------------------|
611
+ | `id` | `str` | Run ID |
612
+ | `name` | `str` | Job name |
613
+ | `status` | `JobStatus` | Current status |
614
+ | `is_terminal` | `bool` | The run has finished |
615
+ | `create_time` | `datetime` | Creation time |
616
+ | `update_time` | `datetime` | Last update time |
617
+ | `start_time` | `datetime \| None` | Start time |
618
+ | `complete_time` | `datetime \| None` | Completion time |
619
+ | `triggered_by` | `OrganizationCustomer` | User who triggered the run |
620
+ | `kube_app` | `RunKubeApp \| None` | Kubernetes app details |
621
+ | `payload` | `RunPayload` | What the run was created with |
622
+ | `runtime` | `str \| None` | From `payload` |
623
+ | `version` | `str \| None` | From `payload` |
624
+ | `timeout_seconds` | `int` | From `payload` |
625
+ | `run_python` | `RunPythonPayload \| None` | From `payload` |
626
+ | `run_jar` | `RunJarPayload \| None` | From `payload` |
627
+ | `environment` | `ResolvedRunEnvironment \| None` | From `payload` |
628
+ | `region` | `str \| None` | From `kube_app` |
629
+ | `app_meta` | `RunAppMeta \| None` | Spark and Sedona UI URLs, from `kube_app` |
630
+ | `raw` | `dict` | The response body as the server sent it |
629
631
 
630
632
  ### LogsResponse
631
633
 
632
634
  Returned by `get_logs()`.
633
635
 
634
- | Field | Type | Description |
635
- |----------------|------------------------|------------------------------|
636
- | `items` | `list[LogItem]` | Log entries |
637
- | `next_page` | `int \| str \| None` | Next page cursor |
638
- | `current_page` | `int \| str \| None` | Current page cursor |
636
+ | Field | Type | Description |
637
+ |----------------|-----------------|-----------------------------------------------|
638
+ | `items` | `list[LogItem]` | Log entries |
639
+ | `next_page` | `str \| None` | Next page cursor. `None` on a tail page |
640
+ | `current_page` | `str` | Current page cursor |
641
+ | `raw` | `dict` | The response body as the server sent it |
639
642
 
640
643
  ### LogItem
641
644
 
642
- | Field | Type | Description |
643
- |-------------|------------------------|---------------------------------|
644
- | `raw` | `str` | Raw log line text |
645
- | `timestamp` | `int \| str \| None` | Epoch int or ISO-8601 string |
646
- | `level` | `str \| None` | Log level (INFO, ERROR, etc.) |
647
- | `message` | `str \| None` | Parsed message |
648
- | `extra` | `dict` | Additional fields |
645
+ | Field | Type | Description |
646
+ |-------------|-------|-----------------------------------|
647
+ | `raw` | `str` | Raw log line text |
648
+ | `timestamp` | `str` | Epoch nanoseconds, as a string |
649
649
 
650
650
  ### RunListPage
651
651
 
652
652
  Returned by `list_runs()`.
653
653
 
654
- | Field | Type | Description |
655
- |--------------------------|-------------------|--------------------------------|
656
- | `items` | `list[RunView]` | Runs on this page |
657
- | `total` | `int` | Total matching runs |
658
- | `next_page` | `str \| None` | Next page cursor |
659
- | `previous_page` | `str \| None` | Previous page cursor |
660
- | `current_page` | `str \| None` | Current page cursor |
661
- | `current_page_backwards` | `str \| None` | Backward pagination cursor |
654
+ | Field | Type | Description |
655
+ |--------------------------|-----------------|-----------------------------------------|
656
+ | `items` | `list[RunView]` | Runs on this page |
657
+ | `total` | `int` | Total matching runs |
658
+ | `next_page` | `str \| None` | Next page cursor |
659
+ | `previous_page` | `str \| None` | Previous page cursor |
660
+ | `current_page` | `str \| None` | Current page cursor |
661
+ | `current_page_backwards` | `str \| None` | Backward pagination cursor |
662
+ | `raw` | `dict` | The response body as the server sent it |
662
663
 
663
664
  ### RunMetricsResponse
664
665
 
665
666
  Returned by `get_metrics()`.
666
667
 
667
- | Field | Type | Description |
668
- |-------------------|--------|--------------------------|
669
- | `series_metrics` | `dict` | Time-series metrics |
670
- | `instant_metrics` | `dict` | Point-in-time metrics |
671
- | `extra` | `dict` | Additional fields |
668
+ | Field | Type | Description |
669
+ |-------------------|----------------------------------|-----------------------------------------|
670
+ | `series_metrics` | `dict[str, SeriesMetricDetails]` | Time-series metrics |
671
+ | `instant_metrics` | `dict[str, InstantMetricDetails]` | Point-in-time metrics |
672
+ | `raw` | `dict` | The response body as the server sent it |
672
673
 
673
674
  ## Exceptions
674
675
 
@@ -13,7 +13,7 @@ Additional Wherobots surfaces will be added over time.
13
13
  ## Features
14
14
 
15
15
  - Submit Python scripts or JARs as Wherobots jobs
16
- - Auto-upload local scripts via presigned URLs (only needs an API key)
16
+ - Auto-upload local scripts to Wherobots managed storage (only needs an API key)
17
17
  - Stream or iterate logs with pagination
18
18
  - List runs with status, name, and date filters
19
19
  - Typed dataclass models for all API responses (no pydantic dependency)
@@ -35,7 +35,7 @@ The simplest way to run a local script — only an API key is needed:
35
35
  from wherobots import WherobotsJob
36
36
 
37
37
  job = WherobotsJob(
38
- script="my_analysis.py", # local file — auto-uploaded via presigned URL
38
+ script="my_analysis.py", # local file — auto-uploaded to managed storage
39
39
  name="analysis-job-001",
40
40
  runtime="tiny",
41
41
  region="aws-us-west-2",
@@ -62,8 +62,7 @@ job = WherobotsJob(
62
62
  ### Script Upload Behavior
63
63
 
64
64
  When `script` is a local file path (not an `s3://` URI) and `auto_upload=True`
65
- (the default), the SDK uploads your script via a presigned S3 URL to Wherobots
66
- managed storage. Only needs a valid API key — no AWS credentials required.
65
+ (the default), the SDK uploads your script to Wherobots managed storage. Only needs a valid API key — no AWS credentials required.
67
66
 
68
67
  You can also reference scripts already in a
69
68
  [Storage Integration](https://docs.wherobots.com/latest/develop/storage-management/storage/)
@@ -109,7 +108,7 @@ job = WherobotsJob(script="s3://bucket/script.py", name="my-job-001")
109
108
  | `WHEROBOTS_API_KEY` | API key | *(required outside Wherobots)* |
110
109
  | `WHEROBOTS_REGION` | Region override (else org default) | *(none — org default)* |
111
110
  | `WHEROBOTS_API_BASE_URL` | API base URL | `https://api.cloud.wherobots.com` |
112
- | `WHEROBOTS_VERSION` | Wherobots version | `latest` |
111
+ | `WHEROBOTS_VERSION` | Runtime version | *(none, the org preset decides)* |
113
112
  | `WHEROBOTS_REQUEST_TIMEOUT_SECONDS`| HTTP request timeout (seconds) | `30` |
114
113
  | `WHEROBOTS_CLIENT_CHAIN` | Upstream client-attribution chain (see below) | *(none)* |
115
114
  | `WHEROBOTS_ID_TOKEN_PATH` | Workload identity token, set by Wherobots notebooks and jobs | *(none)* |
@@ -140,7 +139,7 @@ config = WherobotsConfig(
140
139
  | `api_key` | `str \| None` | `None` (read from env) |
141
140
  | `region` | `str \| None` | `None` |
142
141
  | `base_url` | `str` | `"https://api.cloud.wherobots.com"` |
143
- | `version` | `str` | `"latest"` |
142
+ | `version` | `str \| None` | `None` (org preset) |
144
143
  | `request_timeout_seconds` | `int` | `30` |
145
144
  | `client_chain` | `str \| None` | `None` |
146
145
 
@@ -187,11 +186,11 @@ WherobotsJob(
187
186
  runtime: str | Runtime | None = None, # Compute size (None -> org default)
188
187
  region: str | Region | None = None, # Region; str passed as-is (None -> org default)
189
188
  api_key: str | None = None, # API key (or env var)
190
- version: str | None = None, # "latest" | "preview"
189
+ version: str | None = None, # "latest" | "preview" (None -> org preset)
191
190
  timeout_seconds: int = 3600, # Job timeout
192
191
  args: list[str] | None = None, # Script arguments
193
192
  spark_configs: dict[str, str] | None = None, # Spark config overrides
194
- dependencies: list[dict] | None = None, # PyPI or file dependencies
193
+ dependencies: list[PyPiDependency | FileDependency] | None = None,
195
194
  spark_driver_disk_gb: int | None = None, # Driver disk size (GB)
196
195
  spark_executor_disk_gb: int | None = None, # Executor disk size (GB)
197
196
  jar_main_class: str | None = None, # Main class (required for JARs)
@@ -209,14 +208,14 @@ WherobotsJob(
209
208
  |--------|---------|-------------|
210
209
  | `submit()` | `str` | Submit the job. Returns the run ID. Idempotent (returns existing ID if already submitted). |
211
210
  | `get_status()` | `RunView` | Get current job status and full details. |
212
- | `get_logs(cursor=0, size=100)` | `LogsResponse` | Fetch a page of log entries. |
211
+ | `get_logs(cursor=None, size=100)` | `LogsResponse` | Fetch a page of log entries. The cursor is an opaque string from `next_page`. |
213
212
  | `get_metrics()` | `RunMetricsResponse` | Fetch CPU/memory metrics for the run. |
214
213
  | `get_cpu_utilization()` | `UtilizationStats` | Aggregated CPU utilization (`latest`, `max`, `avg`, `series`). |
215
214
  | `get_mem_utilization()` | `UtilizationStats` | Aggregated memory utilization (`latest`, `max`, `avg`, `series`). |
216
215
  | `get_cost()` | `float \| None` | Total run cost in USD, or `None` if not yet billed. |
217
216
  | `get_consumed_spatial_units()` | `float \| None` | Spatial Units (SUs) consumed by the run. |
218
217
  | `refresh()` | `RunView` | Re-fetch from the API and update `status`/`name`/`runtime`/`region`/`version` in place. |
219
- | `iter_logs(cursor=0, size=100)` | `Iterator[dict]` | Iterate over all log entries, handling pagination automatically. |
218
+ | `iter_logs(cursor=None, size=100)` | `Iterator[dict]` | Iterate over all log entries, handling pagination automatically. |
220
219
  | `poll_for_logs(follow=True, interval=2.0, log_handler=None, max_errors=10)` | `None` | Poll and print logs. If `follow=True`, continues until job completes. `max_errors` sets the max consecutive transient errors before giving up. |
221
220
  | `cancel()` | `bool` | Request cancellation. Returns `True` on success. |
222
221
  | `wait_for_completion(poll_interval=5.0, stream_logs=True, log_interval=2.0, max_wait_seconds=None)` | `JobStatus` | Block until the job reaches a terminal state. Set `max_wait_seconds` to limit wait time (raises `WherobotsTimeoutError`). |
@@ -243,8 +242,8 @@ with WherobotsJob(script="s3://bucket/script.py", name="my-job") as job:
243
242
  |--------|---------|-------------|
244
243
  | `from_run_id(run_id, api_key=None, ...)` | `WherobotsJob` | Attach to an existing run for read-only log/metric access. No script required. `submit()` is disabled on the returned instance. |
245
244
  | `list_runs(...)` | `RunListPage` | List runs with optional filters. No instance required. |
246
- | `add_pypi_dependency(name, version)` | `dict` | Create a PyPI dependency dict for the `dependencies` parameter. |
247
- | `add_file_dependency(file_path)` | `dict` | Create a file dependency dict (`.jar`, `.whl`, `.zip`, `.json`). Accepts an `s3://` URI or a local path — local paths are auto-uploaded to **managed storage** at `submit()` time. For non-managed destinations, upload via `FilesAPI` first and pass the resulting `s3://` URI. |
245
+ | `add_pypi_dependency(library_name, library_version=None)` | `PyPiDependency` | Create a PyPI dependency for the `dependencies` parameter. |
246
+ | `add_file_dependency(file_path)` | `FileDependency` | Create a file dependency (`.jar`, `.whl`, `.zip`, `.json`). Accepts an `s3://` URI or a local path — local paths are auto-uploaded to **managed storage** at `submit()` time. For non-managed destinations, upload via `FilesAPI` first and pass the resulting `s3://` URI. |
248
247
 
249
248
  #### Attaching to an Existing Run
250
249
 
@@ -572,77 +571,79 @@ job = WherobotsJob(
572
571
 
573
572
  ## Models
574
573
 
575
- All models are Python dataclasses with `from_dict()` and `to_dict()` methods
576
- for JSON round-tripping.
574
+ Models are generated from the Wherobots OpenAPI spec. They are frozen dataclasses built with
575
+ keyword arguments, with `from_dict()` and `to_dict()` for the API's JSON. A missing required field
576
+ or a wrong type raises `WherobotsAPIError`. Unknown fields are ignored, and an enum value newer than
577
+ the SDK still decodes, so `status.value` works for it.
577
578
 
578
579
  ### RunView
579
580
 
580
581
  Returned by `get_status()` and `list_runs()`. Represents a single job run.
581
582
 
582
- | Field | Type | Description |
583
- |--------------------|---------------------------|--------------------------------|
584
- | `id` | `str` | Run ID |
585
- | `name` | `str` | Job name |
586
- | `status` | `JobStatus \| None` | Current status |
587
- | `runtime` | `str \| None` | Compute runtime size |
588
- | `region` | `str \| None` | AWS region |
589
- | `version` | `str \| None` | Wherobots version |
590
- | `timeout_seconds` | `int \| None` | Job timeout |
591
- | `create_time` | `str \| None` | ISO-8601 creation timestamp |
592
- | `update_time` | `str \| None` | ISO-8601 last update timestamp |
593
- | `start_time` | `str \| None` | ISO-8601 start timestamp |
594
- | `complete_time` | `str \| None` | ISO-8601 completion timestamp |
595
- | `run_python` | `RunPythonPayload \| None`| Python script payload |
596
- | `run_jar` | `RunJarPayload \| None` | JAR payload |
597
- | `environment` | `RunEnvironment \| None` | Spark config & dependencies |
598
- | `triggered_by` | `dict \| None` | User who triggered the run |
599
- | `kube_app` | `RunKubeApp \| None` | Kubernetes app details |
600
- | `app_meta` | `RunAppMeta \| None` | Spark/Sedona UI URLs |
601
- | `organization` | `OrganizationCustomer \| None` | Org info |
602
- | `extra` | `dict` | Any additional API fields |
583
+ | Field | Type | Description |
584
+ |-------------------|----------------------------|--------------------------------------------|
585
+ | `id` | `str` | Run ID |
586
+ | `name` | `str` | Job name |
587
+ | `status` | `JobStatus` | Current status |
588
+ | `is_terminal` | `bool` | The run has finished |
589
+ | `create_time` | `datetime` | Creation time |
590
+ | `update_time` | `datetime` | Last update time |
591
+ | `start_time` | `datetime \| None` | Start time |
592
+ | `complete_time` | `datetime \| None` | Completion time |
593
+ | `triggered_by` | `OrganizationCustomer` | User who triggered the run |
594
+ | `kube_app` | `RunKubeApp \| None` | Kubernetes app details |
595
+ | `payload` | `RunPayload` | What the run was created with |
596
+ | `runtime` | `str \| None` | From `payload` |
597
+ | `version` | `str \| None` | From `payload` |
598
+ | `timeout_seconds` | `int` | From `payload` |
599
+ | `run_python` | `RunPythonPayload \| None` | From `payload` |
600
+ | `run_jar` | `RunJarPayload \| None` | From `payload` |
601
+ | `environment` | `ResolvedRunEnvironment \| None` | From `payload` |
602
+ | `region` | `str \| None` | From `kube_app` |
603
+ | `app_meta` | `RunAppMeta \| None` | Spark and Sedona UI URLs, from `kube_app` |
604
+ | `raw` | `dict` | The response body as the server sent it |
603
605
 
604
606
  ### LogsResponse
605
607
 
606
608
  Returned by `get_logs()`.
607
609
 
608
- | Field | Type | Description |
609
- |----------------|------------------------|------------------------------|
610
- | `items` | `list[LogItem]` | Log entries |
611
- | `next_page` | `int \| str \| None` | Next page cursor |
612
- | `current_page` | `int \| str \| None` | Current page cursor |
610
+ | Field | Type | Description |
611
+ |----------------|-----------------|-----------------------------------------------|
612
+ | `items` | `list[LogItem]` | Log entries |
613
+ | `next_page` | `str \| None` | Next page cursor. `None` on a tail page |
614
+ | `current_page` | `str` | Current page cursor |
615
+ | `raw` | `dict` | The response body as the server sent it |
613
616
 
614
617
  ### LogItem
615
618
 
616
- | Field | Type | Description |
617
- |-------------|------------------------|---------------------------------|
618
- | `raw` | `str` | Raw log line text |
619
- | `timestamp` | `int \| str \| None` | Epoch int or ISO-8601 string |
620
- | `level` | `str \| None` | Log level (INFO, ERROR, etc.) |
621
- | `message` | `str \| None` | Parsed message |
622
- | `extra` | `dict` | Additional fields |
619
+ | Field | Type | Description |
620
+ |-------------|-------|-----------------------------------|
621
+ | `raw` | `str` | Raw log line text |
622
+ | `timestamp` | `str` | Epoch nanoseconds, as a string |
623
623
 
624
624
  ### RunListPage
625
625
 
626
626
  Returned by `list_runs()`.
627
627
 
628
- | Field | Type | Description |
629
- |--------------------------|-------------------|--------------------------------|
630
- | `items` | `list[RunView]` | Runs on this page |
631
- | `total` | `int` | Total matching runs |
632
- | `next_page` | `str \| None` | Next page cursor |
633
- | `previous_page` | `str \| None` | Previous page cursor |
634
- | `current_page` | `str \| None` | Current page cursor |
635
- | `current_page_backwards` | `str \| None` | Backward pagination cursor |
628
+ | Field | Type | Description |
629
+ |--------------------------|-----------------|-----------------------------------------|
630
+ | `items` | `list[RunView]` | Runs on this page |
631
+ | `total` | `int` | Total matching runs |
632
+ | `next_page` | `str \| None` | Next page cursor |
633
+ | `previous_page` | `str \| None` | Previous page cursor |
634
+ | `current_page` | `str \| None` | Current page cursor |
635
+ | `current_page_backwards` | `str \| None` | Backward pagination cursor |
636
+ | `raw` | `dict` | The response body as the server sent it |
636
637
 
637
638
  ### RunMetricsResponse
638
639
 
639
640
  Returned by `get_metrics()`.
640
641
 
641
- | Field | Type | Description |
642
- |-------------------|--------|--------------------------|
643
- | `series_metrics` | `dict` | Time-series metrics |
644
- | `instant_metrics` | `dict` | Point-in-time metrics |
645
- | `extra` | `dict` | Additional fields |
642
+ | Field | Type | Description |
643
+ |-------------------|----------------------------------|-----------------------------------------|
644
+ | `series_metrics` | `dict[str, SeriesMetricDetails]` | Time-series metrics |
645
+ | `instant_metrics` | `dict[str, InstantMetricDetails]` | Point-in-time metrics |
646
+ | `raw` | `dict` | The response body as the server sent it |
646
647
 
647
648
  ## Exceptions
648
649
 
@@ -37,6 +37,7 @@ Documentation = "https://docs.wherobots.com"
37
37
  # PEP 735 dev dependencies — installed with `uv sync --group dev`.
38
38
  [dependency-groups]
39
39
  dev = [
40
+ "jsonschema>=4.23",
40
41
  "pytest==9.1.1",
41
42
  "pytest-cov==7.1.0",
42
43
  "pytest-mock==3.17.0",
@@ -97,6 +98,14 @@ extend-ignore = ["SIM117", "EM101", "EM102", "TRY003", "PLR0917"]
97
98
  # Package __init__ groups exports by category with comment headers;
98
99
  # don't let ruff re-sort them alphabetically.
99
100
  "wherobots/__init__.py" = ["RUF022"]
101
+ # Generated from the spec: names and docstrings are the API's, and the annotations
102
+ # are evaluated at runtime by the wire decoder.
103
+ "wherobots/models/_generated.py" = ["A", "D", "E501", "FBT", "TC"]
104
+ "wherobots/enums/_generated.py" = ["D", "E501"]
105
+ "wherobots/api/_operations.py" = ["A", "D", "E501", "FBT", "PLR0913", "TC"]
106
+ "wherobots/{enums,models}/__init__.py" = ["D", "RUF022"]
107
+ # Dev tools rather than package code.
108
+ "scripts/*.py" = ["D", "INP001", "PLR0911", "S310", "S603", "S607", "T201"]
100
109
 
101
110
  [tool.pyrefly]
102
111
  project-includes = ["wherobots"]
@@ -112,4 +121,5 @@ python_functions = ["test_*"]
112
121
  addopts = ["--cov=wherobots", "--cov-report=html", "--cov-report=term-missing", "-m", "not integration"]
113
122
  markers = [
114
123
  "integration: live API tests requiring WHEROBOTS_API_KEY (deselected by default)",
124
+ "off_contract: feeds a response the spec forbids, so skip the spec_contract fixture",
115
125
  ]