pipekit-sdk 2.0.0__tar.gz → 2.0.1__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.1
2
2
  Name: pipekit-sdk
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: Pipekit Python SDK
5
5
  Home-page: https://pipekit.io
6
6
  License: BSD-3-Clause
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pipekit-sdk"
3
- version = "2.0.0"
3
+ version = "2.0.1"
4
4
  description = "Pipekit Python SDK"
5
5
  authors = ["Pipekit <ci@pipekit.io>"]
6
6
  license = "BSD-3-Clause"
@@ -4,8 +4,8 @@ from __future__ import annotations
4
4
 
5
5
  from typing import Any
6
6
 
7
- from pipekit_sdk.models._config import BaseModel
7
+ from pydantic import RootModel
8
8
 
9
9
 
10
- class Model(BaseModel):
11
- __root__: Any
10
+ class Model(RootModel[Any]):
11
+ root: Any
@@ -0,0 +1,9 @@
1
+ from pydantic import BaseModel as PydanticBaseModel
2
+ from pydantic import ConfigDict
3
+
4
+
5
+ class BaseModel(PydanticBaseModel):
6
+ model_config = ConfigDict(
7
+ populate_by_name=True, # support populating object by Field alias
8
+ use_enum_values=True, # supports using enums, which are then unpacked to obtain the actual `.value`
9
+ )
@@ -2,10 +2,9 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from datetime import datetime
6
5
  from typing import Dict, List, Optional
7
6
 
8
- from pydantic import Field
7
+ from pydantic import AwareDatetime, Field
9
8
  from typing_extensions import Annotated
10
9
 
11
10
  from pipekit_sdk.models._config import BaseModel
@@ -13,7 +12,7 @@ from pipekit_sdk.models._config import BaseModel
13
12
 
14
13
  class Cluster(BaseModel):
15
14
  api_key: Annotated[Optional[str], Field(alias="apiKey")] = None
16
- created_at: Annotated[datetime, Field(alias="createdAt")]
15
+ created_at: Annotated[AwareDatetime, Field(alias="createdAt")]
17
16
  description: str
18
17
  identity_uuid: Annotated[str, Field(alias="identityUUID")]
19
18
  is_active: Annotated[bool, Field(alias="isActive")]
@@ -23,7 +22,7 @@ class Cluster(BaseModel):
23
22
  pipekit_agent_version: Annotated[str, Field(alias="pipekitAgentVersion")]
24
23
  port: Optional[int] = None
25
24
  type: List[str]
26
- updated_at: Annotated[datetime, Field(alias="updatedAt")]
25
+ updated_at: Annotated[AwareDatetime, Field(alias="updatedAt")]
27
26
  uuid: str
28
27
  workflow_group_priorities: Annotated[Optional[Dict[str, int]], Field(alias="workflowGroupPriorities")] = None
29
28
 
@@ -43,7 +42,7 @@ class GitInfo(BaseModel):
43
42
 
44
43
  class Logs(BaseModel):
45
44
  container_name: Annotated[str, Field(alias="containerName")]
46
- created_at: Annotated[datetime, Field(alias="createdAt")]
45
+ created_at: Annotated[AwareDatetime, Field(alias="createdAt")]
47
46
  identity_uuid: Annotated[str, Field(alias="identityUUID")]
48
47
  log_type: Annotated[str, Field(alias="logType")]
49
48
  node_id: Annotated[Optional[str], Field(alias="nodeId")] = None
@@ -52,7 +51,7 @@ class Logs(BaseModel):
52
51
  pod_name: Annotated[str, Field(alias="podName")]
53
52
  run_uuid: Annotated[str, Field(alias="runUUID")]
54
53
  stream_cursor: Annotated[str, Field(alias="streamCursor")]
55
- updated_at: Annotated[datetime, Field(alias="updatedAt")]
54
+ updated_at: Annotated[AwareDatetime, Field(alias="updatedAt")]
56
55
 
57
56
 
58
57
  class Pipe(BaseModel):
@@ -77,7 +76,7 @@ class PipeRun(BaseModel):
77
76
  check_id: Annotated[Optional[int], Field(alias="checkId")] = None
78
77
  cluster_name: Annotated[Optional[str], Field(alias="clusterName")] = None
79
78
  cluster_uuid: Annotated[Optional[str], Field(alias="clusterUUID")] = None
80
- created_at: Annotated[Optional[datetime], Field(alias="createdAt")] = None
79
+ created_at: Annotated[Optional[AwareDatetime], Field(alias="createdAt")] = None
81
80
  git_info: Annotated[Optional[GitInfo], Field(alias="gitInfo")] = None
82
81
  identity_uuid: Annotated[Optional[str], Field(alias="identityUUID")] = None
83
82
  message: Optional[str] = None
@@ -92,6 +91,6 @@ class PipeRun(BaseModel):
92
91
  source_name: Annotated[Optional[str], Field(alias="sourceName")] = None
93
92
  source_type: Annotated[Optional[str], Field(alias="sourceType")] = None
94
93
  status: Optional[str] = None
95
- updated_at: Annotated[Optional[datetime], Field(alias="updatedAt")] = None
94
+ updated_at: Annotated[Optional[AwareDatetime], Field(alias="updatedAt")] = None
96
95
  user_name: Annotated[Optional[str], Field(alias="userName")] = None
97
96
  uuid: Optional[str] = None
@@ -2,10 +2,9 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from datetime import datetime
6
5
  from typing import Any, Dict, List, Optional
7
6
 
8
- from pydantic import Field
7
+ from pydantic import AwareDatetime, Field, RootModel
9
8
  from typing_extensions import Annotated
10
9
 
11
10
  from pipekit_sdk.models._config import BaseModel
@@ -276,8 +275,8 @@ class FCVolumeSource(BaseModel):
276
275
  ] = None
277
276
 
278
277
 
279
- class FieldsV1(BaseModel):
280
- __root__: Annotated[
278
+ class FieldsV1(RootModel[Any]):
279
+ root: Annotated[
281
280
  Any,
282
281
  Field(
283
282
  description=(
@@ -1317,7 +1316,7 @@ class TCPSocketAction(BaseModel):
1317
1316
 
1318
1317
 
1319
1318
  class Time(BaseModel):
1320
- time: Annotated[datetime, Field(alias="Time")]
1319
+ time: Annotated[AwareDatetime, Field(alias="Time")]
1321
1320
 
1322
1321
 
1323
1322
  class Toleration(BaseModel):
@@ -4,7 +4,7 @@ from __future__ import annotations
4
4
 
5
5
  from typing import Any, Dict, List, Optional
6
6
 
7
- from pydantic import Field
7
+ from pydantic import Field, RootModel
8
8
  from typing_extensions import Annotated
9
9
 
10
10
  from pipekit_sdk.models._config import BaseModel
@@ -12,8 +12,8 @@ from pipekit_sdk.models._config import BaseModel
12
12
  from . import intstr, v1
13
13
 
14
14
 
15
- class Amount(BaseModel):
16
- __root__: Any
15
+ class Amount(RootModel[Any]):
16
+ root: Any
17
17
 
18
18
 
19
19
  class ArtGCStatus(BaseModel):
@@ -190,8 +190,8 @@ class Histogram(BaseModel):
190
190
  value: str
191
191
 
192
192
 
193
- class Item(BaseModel):
194
- __root__: Any
193
+ class Item(RootModel[Any]):
194
+ root: Any
195
195
 
196
196
 
197
197
  class LabelValueFrom(BaseModel):
@@ -244,8 +244,8 @@ class NodeSynchronizationStatus(BaseModel):
244
244
  waiting: Optional[str] = None
245
245
 
246
246
 
247
- class NoneStrategy(BaseModel):
248
- __root__: Any
247
+ class NoneStrategy(RootModel[Any]):
248
+ root: Any
249
249
 
250
250
 
251
251
  class OAuth2EndpointParam(BaseModel):
@@ -258,12 +258,12 @@ class OSSLifecycleRule(BaseModel):
258
258
  mark_infrequent_access_after_days: Annotated[Optional[int], Field(alias="markInfrequentAccessAfterDays")] = None
259
259
 
260
260
 
261
- class ParallelSteps(BaseModel):
262
- __root__: Any
261
+ class ParallelSteps(RootModel[Any]):
262
+ root: Any
263
263
 
264
264
 
265
- class Plugin(BaseModel):
266
- __root__: Any
265
+ class Plugin(RootModel[Any]):
266
+ root: Any
267
267
 
268
268
 
269
269
  class Prometheus(BaseModel):
@@ -280,8 +280,8 @@ class RawArtifact(BaseModel):
280
280
  data: str
281
281
 
282
282
 
283
- class RetryNodeAntiAffinity(BaseModel):
284
- __root__: Any
283
+ class RetryNodeAntiAffinity(RootModel[Any]):
284
+ root: Any
285
285
 
286
286
 
287
287
  class S3EncryptionOptions(BaseModel):
@@ -315,8 +315,8 @@ class Sequence(BaseModel):
315
315
  start: Optional[intstr.IntOrString] = None
316
316
 
317
317
 
318
- class SuppliedValueFrom(BaseModel):
319
- __root__: Any
318
+ class SuppliedValueFrom(RootModel[Any]):
319
+ root: Any
320
320
 
321
321
 
322
322
  class SuspendTemplate(BaseModel):
@@ -388,8 +388,8 @@ class WorkflowTemplateRef(BaseModel):
388
388
  name: Optional[str] = None
389
389
 
390
390
 
391
- class ZipStrategy(BaseModel):
392
- __root__: Any
391
+ class ZipStrategy(RootModel[Any]):
392
+ root: Any
393
393
 
394
394
 
395
395
  class ArchiveStrategy(BaseModel):
@@ -1689,7 +1689,7 @@ class WorkflowStatus(BaseModel):
1689
1689
  ] = None
1690
1690
 
1691
1691
 
1692
- CronWorkflow.update_forward_refs()
1693
- CronWorkflowSpec.update_forward_refs()
1694
- DAGTask.update_forward_refs()
1695
- Workflow.update_forward_refs()
1692
+ CronWorkflow.model_rebuild()
1693
+ CronWorkflowSpec.model_rebuild()
1694
+ DAGTask.model_rebuild()
1695
+ Workflow.model_rebuild()
@@ -80,7 +80,7 @@ class PipekitService:
80
80
  if clusters_response.status_code // 100 != 2:
81
81
  raise Exception(f"List clusters failed: {clusters_response.text}")
82
82
 
83
- clusters = [Cluster.parse_obj(cluster) for cluster in clusters_response.json()]
83
+ clusters = [Cluster.model_validate(cluster) for cluster in clusters_response.json()]
84
84
  return clusters
85
85
 
86
86
  def list_pipes(
@@ -107,7 +107,7 @@ class PipekitService:
107
107
  if pipes_response.status_code // 100 != 2:
108
108
  raise Exception(f"List pipes failed: {pipes_response.text}")
109
109
 
110
- pipes_page = [Pipe.parse_obj(item) for item in pipes_response.json()["items"]]
110
+ pipes_page = [Pipe.model_validate(item) for item in pipes_response.json()["items"]]
111
111
  if len(pipes_page) == 0:
112
112
  break
113
113
 
@@ -135,7 +135,7 @@ class PipekitService:
135
135
  if pipe_response.status_code // 100 != 2:
136
136
  raise Exception(f"Get pipe failed: {pipe_response.text}")
137
137
 
138
- return Pipe.parse_obj(pipe_response.json())
138
+ return Pipe.model_validate(pipe_response.json())
139
139
 
140
140
  def list_runs_by_cluster(
141
141
  self,
@@ -160,7 +160,7 @@ class PipekitService:
160
160
  if runs_response.status_code // 100 != 2:
161
161
  raise Exception(f"List runs failed: {runs_response.text}")
162
162
 
163
- runs_page = [PipeRun.parse_obj(item) for item in runs_response.json()["items"]]
163
+ runs_page = [PipeRun.model_validate(item) for item in runs_response.json()["items"]]
164
164
  if len(runs_page) == 0:
165
165
  break
166
166
 
@@ -196,7 +196,7 @@ class PipekitService:
196
196
  if runs_response.status_code // 100 != 2:
197
197
  raise Exception(f"List runs failed: {runs_response.text}")
198
198
 
199
- runs_page = [PipeRun.parse_obj(item) for item in runs_response.json()["items"]]
199
+ runs_page = [PipeRun.model_validate(item) for item in runs_response.json()["items"]]
200
200
  if len(runs_page) == 0:
201
201
  break
202
202
 
@@ -224,7 +224,7 @@ class PipekitService:
224
224
  if run_response.status_code // 100 != 2:
225
225
  raise Exception(f"Get run failed: {run_response.text}")
226
226
 
227
- return PipeRun.parse_obj(run_response.json())
227
+ return PipeRun.model_validate(run_response.json())
228
228
 
229
229
  def get_cluster(
230
230
  self,
@@ -241,7 +241,7 @@ class PipekitService:
241
241
  if cluster_response.status_code // 100 != 2:
242
242
  raise Exception(f"Get cluster failed: {cluster_response.text}")
243
243
 
244
- return Cluster.parse_obj(cluster_response.json())
244
+ return Cluster.model_validate(cluster_response.json())
245
245
 
246
246
  def get_cluster_by_name(
247
247
  self,
@@ -293,7 +293,7 @@ class PipekitService:
293
293
  if submit_response.status_code // 100 != 2:
294
294
  raise Exception(f"Submit failed: {submit_response.text}")
295
295
 
296
- return PipeRun.parse_obj(submit_response.json())
296
+ return PipeRun.model_validate(submit_response.json())
297
297
 
298
298
  def create(self, cron_workflow: CronWorkflow, cluster: str, pipe_name: str = "") -> PipeRun:
299
299
  """Create a CronWorkflow on the cluster, under an existing or new pipe with the given name."""
@@ -328,7 +328,7 @@ class PipekitService:
328
328
  if create_response.status_code // 100 != 2:
329
329
  raise Exception(f"Create failed: {create_response.text}")
330
330
 
331
- return PipeRun.parse_obj(create_response.json())
331
+ return PipeRun.model_validate(create_response.json())
332
332
 
333
333
  def __apply_run_action(
334
334
  self,
@@ -348,7 +348,7 @@ class PipekitService:
348
348
  if action_response.status_code // 100 != 2:
349
349
  raise Exception(f"Action failed: {action_response.text}")
350
350
 
351
- return PipeRun.parse_obj(action_response.json())
351
+ return PipeRun.model_validate(action_response.json())
352
352
 
353
353
  def restart(
354
354
  self,
@@ -388,7 +388,7 @@ class PipekitService:
388
388
  if logs_response.status_code // 100 != 2:
389
389
  raise Exception(f"Get logs failed: {logs_response.text}")
390
390
 
391
- return [Logs.parse_obj(log) for log in list(logs_response.json())]
391
+ return [Logs.model_validate(log) for log in list(logs_response.json())]
392
392
 
393
393
  def __get_logs_stream(
394
394
  self,
@@ -464,7 +464,7 @@ class PipekitService:
464
464
  # bye
465
465
  return
466
466
  else:
467
- yield Logs.parse_obj(json.loads(line))
467
+ yield Logs.model_validate(json.loads(line))
468
468
 
469
469
  except requests.exceptions.Timeout:
470
470
  pass # we'll ignore timeout errors and reconnect
@@ -1,15 +0,0 @@
1
- from pydantic.v1 import BaseModel as PydanticBaseModel
2
-
3
-
4
- class BaseModel(PydanticBaseModel):
5
- class Config:
6
- """General config for generated models."""
7
-
8
- allow_population_by_field_name = True
9
- """support populating object by Field alias"""
10
-
11
- allow_mutation = True
12
- """allow mutation of objects post instantiation"""
13
-
14
- use_enum_values = True
15
- """supports using enums, which are then unpacked to obtain the actual `.value`"""
File without changes
File without changes