zenml-nightly 0.58.2.dev20240617__py3-none-any.whl → 0.58.2.dev20240619__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.
Files changed (312) hide show
  1. zenml/VERSION +1 -1
  2. zenml/_hub/client.py +8 -5
  3. zenml/actions/base_action.py +8 -10
  4. zenml/artifact_stores/base_artifact_store.py +20 -15
  5. zenml/artifact_stores/local_artifact_store.py +3 -2
  6. zenml/artifacts/artifact_config.py +34 -19
  7. zenml/artifacts/external_artifact.py +18 -8
  8. zenml/artifacts/external_artifact_config.py +14 -6
  9. zenml/artifacts/unmaterialized_artifact.py +2 -11
  10. zenml/cli/__init__.py +6 -0
  11. zenml/cli/artifact.py +20 -2
  12. zenml/cli/served_model.py +0 -1
  13. zenml/cli/server.py +3 -3
  14. zenml/cli/utils.py +36 -40
  15. zenml/cli/web_login.py +2 -2
  16. zenml/client.py +198 -24
  17. zenml/client_lazy_loader.py +20 -14
  18. zenml/config/base_settings.py +5 -6
  19. zenml/config/build_configuration.py +1 -1
  20. zenml/config/compiler.py +3 -3
  21. zenml/config/docker_settings.py +27 -28
  22. zenml/config/global_config.py +33 -37
  23. zenml/config/pipeline_configurations.py +8 -11
  24. zenml/config/pipeline_run_configuration.py +6 -2
  25. zenml/config/pipeline_spec.py +3 -4
  26. zenml/config/resource_settings.py +8 -9
  27. zenml/config/schedule.py +16 -20
  28. zenml/config/secret_reference_mixin.py +6 -3
  29. zenml/config/secrets_store_config.py +16 -23
  30. zenml/config/server_config.py +50 -46
  31. zenml/config/settings_resolver.py +1 -1
  32. zenml/config/source.py +45 -35
  33. zenml/config/step_configurations.py +53 -31
  34. zenml/config/step_run_info.py +3 -0
  35. zenml/config/store_config.py +20 -19
  36. zenml/config/strict_base_model.py +2 -6
  37. zenml/constants.py +26 -2
  38. zenml/container_registries/base_container_registry.py +3 -2
  39. zenml/container_registries/default_container_registry.py +3 -3
  40. zenml/event_hub/base_event_hub.py +1 -1
  41. zenml/event_sources/base_event_source.py +11 -16
  42. zenml/exceptions.py +4 -0
  43. zenml/integrations/airflow/__init__.py +2 -6
  44. zenml/integrations/airflow/flavors/airflow_orchestrator_flavor.py +6 -7
  45. zenml/integrations/airflow/orchestrators/airflow_orchestrator.py +13 -249
  46. zenml/integrations/airflow/orchestrators/dag_generator.py +5 -3
  47. zenml/integrations/argilla/flavors/argilla_annotator_flavor.py +5 -4
  48. zenml/integrations/aws/__init__.py +1 -1
  49. zenml/integrations/aws/flavors/aws_container_registry_flavor.py +3 -2
  50. zenml/integrations/aws/flavors/sagemaker_orchestrator_flavor.py +11 -5
  51. zenml/integrations/aws/flavors/sagemaker_step_operator_flavor.py +6 -2
  52. zenml/integrations/aws/service_connectors/aws_service_connector.py +5 -4
  53. zenml/integrations/aws/step_operators/sagemaker_step_operator.py +1 -1
  54. zenml/integrations/azure/flavors/azureml_step_operator_flavor.py +4 -4
  55. zenml/integrations/azure/service_connectors/azure_service_connector.py +4 -3
  56. zenml/integrations/azure/step_operators/azureml_step_operator.py +2 -1
  57. zenml/integrations/bentoml/steps/bentoml_deployer.py +1 -1
  58. zenml/integrations/bitbucket/plugins/event_sources/bitbucket_webhook_event_source.py +8 -12
  59. zenml/integrations/comet/flavors/comet_experiment_tracker_flavor.py +1 -1
  60. zenml/integrations/constants.py +0 -1
  61. zenml/integrations/deepchecks/__init__.py +1 -0
  62. zenml/integrations/evidently/__init__.py +5 -3
  63. zenml/integrations/evidently/column_mapping.py +11 -3
  64. zenml/integrations/evidently/data_validators/evidently_data_validator.py +21 -3
  65. zenml/integrations/evidently/metrics.py +5 -6
  66. zenml/integrations/evidently/tests.py +5 -6
  67. zenml/integrations/facets/models.py +2 -6
  68. zenml/integrations/feast/__init__.py +3 -1
  69. zenml/integrations/feast/feature_stores/feast_feature_store.py +0 -23
  70. zenml/integrations/gcp/__init__.py +1 -1
  71. zenml/integrations/gcp/flavors/vertex_orchestrator_flavor.py +1 -1
  72. zenml/integrations/gcp/flavors/vertex_step_operator_flavor.py +1 -1
  73. zenml/integrations/gcp/orchestrators/vertex_orchestrator.py +234 -103
  74. zenml/integrations/gcp/service_connectors/gcp_service_connector.py +57 -42
  75. zenml/integrations/gcp/step_operators/vertex_step_operator.py +1 -0
  76. zenml/integrations/github/code_repositories/github_code_repository.py +1 -1
  77. zenml/integrations/github/plugins/event_sources/github_webhook_event_source.py +9 -13
  78. zenml/integrations/great_expectations/__init__.py +1 -1
  79. zenml/integrations/great_expectations/data_validators/ge_data_validator.py +44 -44
  80. zenml/integrations/great_expectations/flavors/great_expectations_data_validator_flavor.py +35 -2
  81. zenml/integrations/great_expectations/ge_store_backend.py +24 -11
  82. zenml/integrations/great_expectations/materializers/ge_materializer.py +3 -3
  83. zenml/integrations/great_expectations/utils.py +5 -5
  84. zenml/integrations/huggingface/__init__.py +3 -0
  85. zenml/integrations/huggingface/flavors/huggingface_model_deployer_flavor.py +1 -1
  86. zenml/integrations/huggingface/steps/__init__.py +3 -0
  87. zenml/integrations/huggingface/steps/accelerate_runner.py +149 -0
  88. zenml/integrations/huggingface/steps/huggingface_deployer.py +2 -2
  89. zenml/integrations/hyperai/flavors/hyperai_orchestrator_flavor.py +1 -1
  90. zenml/integrations/hyperai/service_connectors/hyperai_service_connector.py +4 -3
  91. zenml/integrations/kubeflow/__init__.py +1 -1
  92. zenml/integrations/kubeflow/flavors/kubeflow_orchestrator_flavor.py +48 -81
  93. zenml/integrations/kubeflow/orchestrators/kubeflow_orchestrator.py +295 -245
  94. zenml/integrations/kubernetes/flavors/kubernetes_orchestrator_flavor.py +1 -1
  95. zenml/integrations/kubernetes/orchestrators/kubernetes_orchestrator_entrypoint.py +11 -2
  96. zenml/integrations/kubernetes/pod_settings.py +17 -31
  97. zenml/integrations/kubernetes/service_connectors/kubernetes_service_connector.py +8 -7
  98. zenml/integrations/label_studio/__init__.py +1 -3
  99. zenml/integrations/label_studio/annotators/label_studio_annotator.py +3 -4
  100. zenml/integrations/label_studio/flavors/label_studio_annotator_flavor.py +2 -2
  101. zenml/integrations/langchain/__init__.py +5 -1
  102. zenml/integrations/langchain/materializers/document_materializer.py +44 -8
  103. zenml/integrations/mlflow/__init__.py +9 -3
  104. zenml/integrations/mlflow/experiment_trackers/mlflow_experiment_tracker.py +1 -1
  105. zenml/integrations/mlflow/flavors/mlflow_experiment_tracker_flavor.py +29 -37
  106. zenml/integrations/mlflow/model_registries/mlflow_model_registry.py +4 -4
  107. zenml/integrations/mlflow/steps/mlflow_deployer.py +1 -1
  108. zenml/integrations/neptune/flavors/neptune_experiment_tracker_flavor.py +1 -1
  109. zenml/integrations/neural_prophet/__init__.py +5 -1
  110. zenml/integrations/pigeon/flavors/pigeon_annotator_flavor.py +1 -1
  111. zenml/integrations/s3/flavors/s3_artifact_store_flavor.py +9 -8
  112. zenml/integrations/seldon/seldon_client.py +52 -67
  113. zenml/integrations/seldon/services/seldon_deployment.py +3 -3
  114. zenml/integrations/seldon/steps/seldon_deployer.py +4 -4
  115. zenml/integrations/skypilot/flavors/skypilot_orchestrator_base_vm_config.py +15 -5
  116. zenml/integrations/skypilot_aws/__init__.py +1 -1
  117. zenml/integrations/skypilot_aws/flavors/skypilot_orchestrator_aws_vm_flavor.py +1 -1
  118. zenml/integrations/skypilot_azure/__init__.py +1 -1
  119. zenml/integrations/skypilot_azure/flavors/skypilot_orchestrator_azure_vm_flavor.py +1 -1
  120. zenml/integrations/skypilot_gcp/__init__.py +2 -1
  121. zenml/integrations/skypilot_gcp/flavors/skypilot_orchestrator_gcp_vm_flavor.py +1 -1
  122. zenml/integrations/skypilot_lambda/flavors/skypilot_orchestrator_lambda_vm_flavor.py +2 -2
  123. zenml/integrations/spark/flavors/spark_step_operator_flavor.py +1 -1
  124. zenml/integrations/spark/step_operators/spark_step_operator.py +2 -0
  125. zenml/integrations/tekton/__init__.py +1 -1
  126. zenml/integrations/tekton/flavors/tekton_orchestrator_flavor.py +66 -23
  127. zenml/integrations/tekton/orchestrators/tekton_orchestrator.py +547 -233
  128. zenml/integrations/tensorboard/__init__.py +1 -12
  129. zenml/integrations/tensorboard/services/tensorboard_service.py +3 -5
  130. zenml/integrations/tensorboard/visualizers/tensorboard_visualizer.py +6 -6
  131. zenml/integrations/tensorflow/__init__.py +2 -10
  132. zenml/integrations/tensorflow/materializers/keras_materializer.py +17 -9
  133. zenml/integrations/wandb/flavors/wandb_experiment_tracker_flavor.py +9 -14
  134. zenml/integrations/whylogs/flavors/whylogs_data_validator_flavor.py +1 -1
  135. zenml/lineage_graph/lineage_graph.py +1 -1
  136. zenml/logging/step_logging.py +15 -7
  137. zenml/materializers/built_in_materializer.py +3 -3
  138. zenml/materializers/pydantic_materializer.py +2 -2
  139. zenml/metadata/lazy_load.py +4 -4
  140. zenml/metadata/metadata_types.py +64 -4
  141. zenml/model/model.py +79 -54
  142. zenml/model_deployers/base_model_deployer.py +14 -12
  143. zenml/model_registries/base_model_registry.py +17 -15
  144. zenml/models/__init__.py +79 -206
  145. zenml/models/v2/base/base.py +54 -41
  146. zenml/models/v2/base/base_plugin_flavor.py +2 -6
  147. zenml/models/v2/base/filter.py +91 -76
  148. zenml/models/v2/base/page.py +2 -12
  149. zenml/models/v2/base/scoped.py +4 -7
  150. zenml/models/v2/core/api_key.py +22 -8
  151. zenml/models/v2/core/artifact.py +2 -2
  152. zenml/models/v2/core/artifact_version.py +74 -40
  153. zenml/models/v2/core/code_repository.py +37 -10
  154. zenml/models/v2/core/component.py +65 -16
  155. zenml/models/v2/core/device.py +14 -4
  156. zenml/models/v2/core/event_source.py +1 -2
  157. zenml/models/v2/core/flavor.py +74 -8
  158. zenml/models/v2/core/logs.py +68 -8
  159. zenml/models/v2/core/model.py +8 -4
  160. zenml/models/v2/core/model_version.py +25 -6
  161. zenml/models/v2/core/model_version_artifact.py +51 -21
  162. zenml/models/v2/core/model_version_pipeline_run.py +45 -13
  163. zenml/models/v2/core/pipeline.py +37 -72
  164. zenml/models/v2/core/pipeline_build.py +29 -17
  165. zenml/models/v2/core/pipeline_deployment.py +18 -6
  166. zenml/models/v2/core/pipeline_namespace.py +113 -0
  167. zenml/models/v2/core/pipeline_run.py +50 -22
  168. zenml/models/v2/core/run_metadata.py +59 -36
  169. zenml/models/v2/core/schedule.py +37 -24
  170. zenml/models/v2/core/secret.py +31 -12
  171. zenml/models/v2/core/service.py +64 -36
  172. zenml/models/v2/core/service_account.py +24 -11
  173. zenml/models/v2/core/service_connector.py +219 -44
  174. zenml/models/v2/core/stack.py +45 -17
  175. zenml/models/v2/core/step_run.py +28 -8
  176. zenml/models/v2/core/tag.py +8 -4
  177. zenml/models/v2/core/trigger.py +2 -2
  178. zenml/models/v2/core/trigger_execution.py +1 -0
  179. zenml/models/v2/core/user.py +18 -21
  180. zenml/models/v2/core/workspace.py +13 -3
  181. zenml/models/v2/misc/build_item.py +3 -3
  182. zenml/models/v2/misc/external_user.py +2 -6
  183. zenml/models/v2/misc/hub_plugin_models.py +9 -9
  184. zenml/models/v2/misc/loaded_visualization.py +2 -2
  185. zenml/models/v2/misc/service_connector_type.py +8 -17
  186. zenml/models/v2/misc/user_auth.py +7 -2
  187. zenml/new/pipelines/build_utils.py +3 -3
  188. zenml/new/pipelines/pipeline.py +17 -13
  189. zenml/new/pipelines/run_utils.py +103 -1
  190. zenml/orchestrators/base_orchestrator.py +10 -7
  191. zenml/orchestrators/local_docker/local_docker_orchestrator.py +1 -1
  192. zenml/orchestrators/step_launcher.py +28 -4
  193. zenml/orchestrators/step_runner.py +3 -6
  194. zenml/orchestrators/utils.py +1 -1
  195. zenml/plugins/base_plugin_flavor.py +6 -10
  196. zenml/plugins/plugin_flavor_registry.py +3 -7
  197. zenml/secret/base_secret.py +7 -8
  198. zenml/service_connectors/docker_service_connector.py +4 -3
  199. zenml/service_connectors/service_connector.py +5 -12
  200. zenml/service_connectors/service_connector_registry.py +2 -4
  201. zenml/services/container/container_service.py +1 -1
  202. zenml/services/container/container_service_endpoint.py +1 -1
  203. zenml/services/local/local_service.py +1 -1
  204. zenml/services/local/local_service_endpoint.py +1 -1
  205. zenml/services/service.py +16 -10
  206. zenml/services/service_type.py +4 -5
  207. zenml/services/terraform/terraform_service.py +1 -1
  208. zenml/stack/flavor.py +1 -5
  209. zenml/stack/flavor_registry.py +4 -4
  210. zenml/stack/stack.py +4 -1
  211. zenml/stack/stack_component.py +55 -31
  212. zenml/step_operators/step_operator_entrypoint_configuration.py +1 -0
  213. zenml/steps/base_step.py +34 -28
  214. zenml/steps/entrypoint_function_utils.py +3 -5
  215. zenml/steps/utils.py +12 -14
  216. zenml/utils/cuda_utils.py +50 -0
  217. zenml/utils/deprecation_utils.py +18 -20
  218. zenml/utils/dict_utils.py +1 -1
  219. zenml/utils/filesync_model.py +65 -28
  220. zenml/utils/function_utils.py +260 -0
  221. zenml/utils/json_utils.py +131 -0
  222. zenml/utils/mlstacks_utils.py +2 -2
  223. zenml/utils/pipeline_docker_image_builder.py +9 -0
  224. zenml/utils/pydantic_utils.py +270 -62
  225. zenml/utils/secret_utils.py +65 -12
  226. zenml/utils/source_utils.py +2 -2
  227. zenml/utils/typed_model.py +5 -3
  228. zenml/utils/typing_utils.py +243 -0
  229. zenml/utils/yaml_utils.py +1 -1
  230. zenml/zen_server/auth.py +2 -2
  231. zenml/zen_server/cloud_utils.py +6 -6
  232. zenml/zen_server/deploy/base_provider.py +1 -1
  233. zenml/zen_server/deploy/deployment.py +6 -8
  234. zenml/zen_server/deploy/docker/docker_zen_server.py +3 -4
  235. zenml/zen_server/deploy/local/local_provider.py +0 -1
  236. zenml/zen_server/deploy/local/local_zen_server.py +6 -6
  237. zenml/zen_server/deploy/terraform/terraform_zen_server.py +4 -6
  238. zenml/zen_server/exceptions.py +4 -1
  239. zenml/zen_server/feature_gate/zenml_cloud_feature_gate.py +1 -1
  240. zenml/zen_server/pipeline_deployment/utils.py +48 -68
  241. zenml/zen_server/rbac/models.py +2 -5
  242. zenml/zen_server/rbac/utils.py +11 -14
  243. zenml/zen_server/routers/auth_endpoints.py +2 -2
  244. zenml/zen_server/routers/pipeline_builds_endpoints.py +1 -1
  245. zenml/zen_server/routers/runs_endpoints.py +1 -1
  246. zenml/zen_server/routers/secrets_endpoints.py +3 -2
  247. zenml/zen_server/routers/server_endpoints.py +1 -1
  248. zenml/zen_server/routers/steps_endpoints.py +1 -1
  249. zenml/zen_server/routers/workspaces_endpoints.py +1 -1
  250. zenml/zen_stores/base_zen_store.py +46 -9
  251. zenml/zen_stores/migrations/utils.py +42 -46
  252. zenml/zen_stores/migrations/versions/0701da9951a0_added_service_table.py +1 -1
  253. zenml/zen_stores/migrations/versions/1041bc644e0d_remove_secrets_manager.py +5 -3
  254. zenml/zen_stores/migrations/versions/10a907dad202_delete_mlmd_tables.py +1 -1
  255. zenml/zen_stores/migrations/versions/26b776ad583e_redesign_artifacts.py +8 -10
  256. zenml/zen_stores/migrations/versions/37835ce041d2_optimizing_database.py +3 -3
  257. zenml/zen_stores/migrations/versions/46506f72f0ed_add_server_settings.py +10 -12
  258. zenml/zen_stores/migrations/versions/5994f9ad0489_introduce_role_permissions.py +3 -2
  259. zenml/zen_stores/migrations/versions/6917bce75069_add_pipeline_run_unique_constraint.py +4 -4
  260. zenml/zen_stores/migrations/versions/728c6369cfaa_add_name_column_to_input_artifact_pk.py +3 -2
  261. zenml/zen_stores/migrations/versions/743ec82b1b3c_update_size_of_build_images.py +2 -2
  262. zenml/zen_stores/migrations/versions/7500f434b71c_remove_shared_columns.py +3 -2
  263. zenml/zen_stores/migrations/versions/7834208cc3f6_artifact_project_scoping.py +8 -7
  264. zenml/zen_stores/migrations/versions/7b651bf6822e_track_secrets_in_db.py +6 -4
  265. zenml/zen_stores/migrations/versions/7e4a481d17f7_add_identity_table.py +2 -2
  266. zenml/zen_stores/migrations/versions/7f603e583dd7_fixed_migration.py +1 -1
  267. zenml/zen_stores/migrations/versions/a39c4184c8ce_remove_secrets_manager_flavors.py +2 -2
  268. zenml/zen_stores/migrations/versions/a91762e6be36_artifact_version_table.py +4 -4
  269. zenml/zen_stores/migrations/versions/alembic_start.py +1 -1
  270. zenml/zen_stores/migrations/versions/fbd7f18ced1e_increase_step_run_field_lengths.py +4 -4
  271. zenml/zen_stores/rest_zen_store.py +109 -49
  272. zenml/zen_stores/schemas/api_key_schemas.py +1 -1
  273. zenml/zen_stores/schemas/artifact_schemas.py +8 -8
  274. zenml/zen_stores/schemas/artifact_visualization_schemas.py +3 -3
  275. zenml/zen_stores/schemas/code_repository_schemas.py +1 -1
  276. zenml/zen_stores/schemas/component_schemas.py +8 -3
  277. zenml/zen_stores/schemas/device_schemas.py +8 -6
  278. zenml/zen_stores/schemas/event_source_schemas.py +3 -4
  279. zenml/zen_stores/schemas/flavor_schemas.py +5 -3
  280. zenml/zen_stores/schemas/model_schemas.py +26 -1
  281. zenml/zen_stores/schemas/pipeline_build_schemas.py +1 -1
  282. zenml/zen_stores/schemas/pipeline_deployment_schemas.py +4 -4
  283. zenml/zen_stores/schemas/pipeline_run_schemas.py +6 -6
  284. zenml/zen_stores/schemas/pipeline_schemas.py +5 -2
  285. zenml/zen_stores/schemas/run_metadata_schemas.py +2 -2
  286. zenml/zen_stores/schemas/secret_schemas.py +8 -5
  287. zenml/zen_stores/schemas/server_settings_schemas.py +3 -1
  288. zenml/zen_stores/schemas/service_connector_schemas.py +1 -1
  289. zenml/zen_stores/schemas/service_schemas.py +11 -2
  290. zenml/zen_stores/schemas/stack_schemas.py +1 -1
  291. zenml/zen_stores/schemas/step_run_schemas.py +11 -11
  292. zenml/zen_stores/schemas/tag_schemas.py +6 -2
  293. zenml/zen_stores/schemas/trigger_schemas.py +2 -2
  294. zenml/zen_stores/schemas/user_schemas.py +2 -2
  295. zenml/zen_stores/schemas/workspace_schemas.py +3 -1
  296. zenml/zen_stores/secrets_stores/aws_secrets_store.py +19 -20
  297. zenml/zen_stores/secrets_stores/azure_secrets_store.py +17 -20
  298. zenml/zen_stores/secrets_stores/base_secrets_store.py +79 -12
  299. zenml/zen_stores/secrets_stores/gcp_secrets_store.py +17 -20
  300. zenml/zen_stores/secrets_stores/hashicorp_secrets_store.py +4 -8
  301. zenml/zen_stores/secrets_stores/service_connector_secrets_store.py +10 -7
  302. zenml/zen_stores/secrets_stores/sql_secrets_store.py +5 -6
  303. zenml/zen_stores/sql_zen_store.py +196 -120
  304. zenml/zen_stores/zen_store_interface.py +33 -0
  305. {zenml_nightly-0.58.2.dev20240617.dist-info → zenml_nightly-0.58.2.dev20240619.dist-info}/METADATA +9 -7
  306. {zenml_nightly-0.58.2.dev20240617.dist-info → zenml_nightly-0.58.2.dev20240619.dist-info}/RECORD +309 -306
  307. zenml/integrations/kubeflow/utils.py +0 -95
  308. zenml/models/v2/base/internal.py +0 -37
  309. zenml/models/v2/base/update.py +0 -44
  310. {zenml_nightly-0.58.2.dev20240617.dist-info → zenml_nightly-0.58.2.dev20240619.dist-info}/LICENSE +0 -0
  311. {zenml_nightly-0.58.2.dev20240617.dist-info → zenml_nightly-0.58.2.dev20240619.dist-info}/WHEEL +0 -0
  312. {zenml_nightly-0.58.2.dev20240617.dist-info → zenml_nightly-0.58.2.dev20240619.dist-info}/entry_points.txt +0 -0
@@ -52,10 +52,10 @@ class PipelineBuildBase(BaseZenModel):
52
52
  title="Whether any image of the build contains user code.",
53
53
  )
54
54
  zenml_version: Optional[str] = Field(
55
- title="The version of ZenML used for this build."
55
+ title="The version of ZenML used for this build.", default=None
56
56
  )
57
57
  python_version: Optional[str] = Field(
58
- title="The Python version used for this build."
58
+ title="The Python version used for this build.", default=None
59
59
  )
60
60
 
61
61
  # Helper methods
@@ -156,13 +156,13 @@ class PipelineBuildBase(BaseZenModel):
156
156
  class PipelineBuildRequest(PipelineBuildBase, WorkspaceScopedRequest):
157
157
  """Request model for pipelines builds."""
158
158
 
159
- checksum: Optional[str] = Field(title="The build checksum.")
159
+ checksum: Optional[str] = Field(title="The build checksum.", default=None)
160
160
 
161
161
  stack: Optional[UUID] = Field(
162
- title="The stack that was used for this build."
162
+ title="The stack that was used for this build.", default=None
163
163
  )
164
164
  pipeline: Optional[UUID] = Field(
165
- title="The pipeline that was used for this build."
165
+ title="The pipeline that was used for this build.", default=None
166
166
  )
167
167
  template_deployment_id: Optional[UUID] = None
168
168
 
@@ -241,7 +241,7 @@ class PipelineBuildResponse(
241
241
  """
242
242
  # Get the base attributes
243
243
  yaml_dict: Dict[str, Any] = json.loads(
244
- self.json(
244
+ self.model_dump_json(
245
245
  exclude={
246
246
  "body",
247
247
  "metadata",
@@ -249,7 +249,7 @@ class PipelineBuildResponse(
249
249
  )
250
250
  )
251
251
  images = json.loads(
252
- self.get_metadata().json(
252
+ self.get_metadata().model_dump_json(
253
253
  exclude={
254
254
  "pipeline",
255
255
  "stack",
@@ -442,29 +442,41 @@ class PipelineBuildResponse(
442
442
  class PipelineBuildFilter(WorkspaceScopedFilter):
443
443
  """Model to enable advanced filtering of all pipeline builds."""
444
444
 
445
- workspace_id: Union[UUID, str, None] = Field(
446
- description="Workspace for this pipeline build."
445
+ workspace_id: Optional[Union[UUID, str]] = Field(
446
+ description="Workspace for this pipeline build.",
447
+ default=None,
448
+ union_mode="left_to_right",
447
449
  )
448
- user_id: Union[UUID, str, None] = Field(
449
- description="User that produced this pipeline build."
450
+ user_id: Optional[Union[UUID, str]] = Field(
451
+ description="User that produced this pipeline build.",
452
+ default=None,
453
+ union_mode="left_to_right",
450
454
  )
451
- pipeline_id: Union[UUID, str, None] = Field(
455
+ pipeline_id: Optional[Union[UUID, str]] = Field(
452
456
  description="Pipeline associated with the pipeline build.",
457
+ default=None,
458
+ union_mode="left_to_right",
453
459
  )
454
- stack_id: Union[UUID, str, None] = Field(
455
- description="Stack used for the Pipeline Run"
460
+ stack_id: Optional[Union[UUID, str]] = Field(
461
+ description="Stack used for the Pipeline Run",
462
+ default=None,
463
+ union_mode="left_to_right",
456
464
  )
457
465
  is_local: Optional[bool] = Field(
458
466
  description="Whether the build images are stored in a container "
459
467
  "registry or locally.",
468
+ default=None,
460
469
  )
461
470
  contains_code: Optional[bool] = Field(
462
471
  description="Whether any image of the build contains user code.",
472
+ default=None,
463
473
  )
464
474
  zenml_version: Optional[str] = Field(
465
- description="The version of ZenML used for this build."
475
+ description="The version of ZenML used for this build.", default=None
466
476
  )
467
477
  python_version: Optional[str] = Field(
468
- description="The Python version used for this build."
478
+ description="The Python version used for this build.", default=None
479
+ )
480
+ checksum: Optional[str] = Field(
481
+ description="The build checksum.", default=None
469
482
  )
470
- checksum: Optional[str] = Field(description="The build checksum.")
@@ -316,20 +316,32 @@ class PipelineDeploymentFilter(WorkspaceScopedFilter):
316
316
  """Model to enable advanced filtering of all pipeline deployments."""
317
317
 
318
318
  workspace_id: Optional[Union[UUID, str]] = Field(
319
- default=None, description="Workspace for this deployment."
319
+ default=None,
320
+ description="Workspace for this deployment.",
321
+ union_mode="left_to_right",
320
322
  )
321
323
  user_id: Optional[Union[UUID, str]] = Field(
322
- default=None, description="User that created this deployment."
324
+ default=None,
325
+ description="User that created this deployment.",
326
+ union_mode="left_to_right",
323
327
  )
324
328
  pipeline_id: Optional[Union[UUID, str]] = Field(
325
- default=None, description="Pipeline associated with the deployment."
329
+ default=None,
330
+ description="Pipeline associated with the deployment.",
331
+ union_mode="left_to_right",
326
332
  )
327
333
  stack_id: Optional[Union[UUID, str]] = Field(
328
- default=None, description="Stack associated with the deployment."
334
+ default=None,
335
+ description="Stack associated with the deployment.",
336
+ union_mode="left_to_right",
329
337
  )
330
338
  build_id: Optional[Union[UUID, str]] = Field(
331
- default=None, description="Build associated with the deployment."
339
+ default=None,
340
+ description="Build associated with the deployment.",
341
+ union_mode="left_to_right",
332
342
  )
333
343
  schedule_id: Optional[Union[UUID, str]] = Field(
334
- default=None, description="Schedule associated with the deployment."
344
+ default=None,
345
+ description="Schedule associated with the deployment.",
346
+ union_mode="left_to_right",
335
347
  )
@@ -0,0 +1,113 @@
1
+ # Copyright (c) ZenML GmbH 2023. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at:
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12
+ # or implied. See the License for the specific language governing
13
+ # permissions and limitations under the License.
14
+ """Models representing pipeline namespaces."""
15
+
16
+ from typing import Optional
17
+ from uuid import UUID
18
+
19
+ from pydantic import Field
20
+
21
+ from zenml.constants import STR_FIELD_MAX_LENGTH
22
+ from zenml.enums import ExecutionStatus
23
+ from zenml.models.v2.base.base import (
24
+ BaseResponse,
25
+ BaseResponseBody,
26
+ BaseResponseMetadata,
27
+ BaseResponseResources,
28
+ )
29
+ from zenml.models.v2.base.filter import BaseFilter
30
+
31
+ # ------------------ Request Model ------------------
32
+
33
+ # There is no request model for pipeline namespaces.
34
+
35
+ # ------------------ Update Model ------------------
36
+
37
+ # There is no update model for pipeline namespaces.
38
+
39
+ # ------------------ Response Model ------------------
40
+
41
+
42
+ class PipelineNamespaceResponseBody(BaseResponseBody):
43
+ """Response body for pipeline namespaces."""
44
+
45
+ latest_run_id: Optional[UUID] = Field(
46
+ default=None,
47
+ title="The ID of the latest run of the pipeline namespace.",
48
+ )
49
+ latest_run_status: Optional[ExecutionStatus] = Field(
50
+ default=None,
51
+ title="The status of the latest run of the pipeline namespace.",
52
+ )
53
+
54
+
55
+ class PipelineNamespaceResponseMetadata(BaseResponseMetadata):
56
+ """Response metadata for pipeline namespaces."""
57
+
58
+
59
+ class PipelineNamespaceResponseResources(BaseResponseResources):
60
+ """Class for all resource models associated with the pipeline namespace entity."""
61
+
62
+
63
+ class PipelineNamespaceResponse(
64
+ BaseResponse[
65
+ PipelineNamespaceResponseBody,
66
+ PipelineNamespaceResponseMetadata,
67
+ PipelineNamespaceResponseResources,
68
+ ]
69
+ ):
70
+ """Response model for pipeline namespaces."""
71
+
72
+ name: str = Field(
73
+ title="The name of the pipeline namespace.",
74
+ max_length=STR_FIELD_MAX_LENGTH,
75
+ )
76
+
77
+ def get_hydrated_version(self) -> "PipelineNamespaceResponse":
78
+ """Get the hydrated version of this pipeline namespace.
79
+
80
+ Returns:
81
+ an instance of the same entity with the metadata field attached.
82
+ """
83
+ return self
84
+
85
+ @property
86
+ def latest_run_id(self) -> Optional[UUID]:
87
+ """The `latest_run_id` property.
88
+
89
+ Returns:
90
+ the value of the property.
91
+ """
92
+ return self.get_body().latest_run_id
93
+
94
+ @property
95
+ def latest_run_status(self) -> Optional[ExecutionStatus]:
96
+ """The `latest_run_status` property.
97
+
98
+ Returns:
99
+ the value of the property.
100
+ """
101
+ return self.get_body().latest_run_status
102
+
103
+
104
+ # ------------------ Filter Model ------------------
105
+
106
+
107
+ class PipelineNamespaceFilter(BaseFilter):
108
+ """Pipeline namespace filter model."""
109
+
110
+ name: Optional[str] = Field(
111
+ default=None,
112
+ description="Name of the pipeline namespace.",
113
+ )
@@ -16,7 +16,6 @@
16
16
  from datetime import datetime
17
17
  from typing import (
18
18
  TYPE_CHECKING,
19
- Any,
20
19
  ClassVar,
21
20
  Dict,
22
21
  List,
@@ -25,7 +24,7 @@ from typing import (
25
24
  )
26
25
  from uuid import UUID
27
26
 
28
- from pydantic import BaseModel, Field
27
+ from pydantic import BaseModel, ConfigDict, Field
29
28
 
30
29
  from zenml.config.pipeline_configurations import PipelineConfiguration
31
30
  from zenml.constants import STR_FIELD_MAX_LENGTH
@@ -42,7 +41,7 @@ from zenml.models.v2.base.scoped import (
42
41
  from zenml.models.v2.core.model_version import ModelVersionResponse
43
42
 
44
43
  if TYPE_CHECKING:
45
- from sqlalchemy.sql.elements import BinaryExpression, BooleanClauseList
44
+ from sqlalchemy.sql.elements import ColumnElement
46
45
 
47
46
  from zenml.models import TriggerExecutionResponse
48
47
  from zenml.models.v2.core.artifact_version import ArtifactVersionResponse
@@ -73,7 +72,8 @@ class PipelineRunRequest(WorkspaceScopedRequest):
73
72
  title="The deployment associated with the pipeline run."
74
73
  )
75
74
  pipeline: Optional[UUID] = Field(
76
- title="The pipeline associated with the pipeline run."
75
+ title="The pipeline associated with the pipeline run.",
76
+ default=None,
77
77
  )
78
78
  orchestrator_run_id: Optional[str] = Field(
79
79
  title="The orchestrator run ID.",
@@ -198,7 +198,15 @@ class PipelineRunResponseMetadata(WorkspaceScopedResponseMetadata):
198
198
  class PipelineRunResponseResources(WorkspaceScopedResponseResources):
199
199
  """Class for all resource models associated with the pipeline run entity."""
200
200
 
201
- model_version: Optional[ModelVersionResponse]
201
+ model_version: Optional[ModelVersionResponse] = None
202
+
203
+ # TODO: In Pydantic v2, the `model_` is a protected namespaces for all
204
+ # fields defined under base models. If not handled, this raises a warning.
205
+ # It is possible to suppress this warning message with the following
206
+ # configuration, however the ultimate solution is to rename these fields.
207
+ # Even though they do not cause any problems right now, if we are not
208
+ # careful we might overwrite some fields protected by pydantic.
209
+ model_config = ConfigDict(protected_namespaces=())
202
210
 
203
211
 
204
212
  class PipelineRunResponse(
@@ -431,48 +439,68 @@ class PipelineRunFilter(WorkspaceScopedFilter):
431
439
  description="Name of the Pipeline Run within the orchestrator",
432
440
  )
433
441
  pipeline_id: Optional[Union[UUID, str]] = Field(
434
- default=None, description="Pipeline associated with the Pipeline Run"
442
+ default=None,
443
+ description="Pipeline associated with the Pipeline Run",
444
+ union_mode="left_to_right",
435
445
  )
436
446
  pipeline_name: Optional[str] = Field(
437
447
  default=None,
438
448
  description="Name of the pipeline associated with the run",
439
449
  )
440
450
  workspace_id: Optional[Union[UUID, str]] = Field(
441
- default=None, description="Workspace of the Pipeline Run"
451
+ default=None,
452
+ description="Workspace of the Pipeline Run",
453
+ union_mode="left_to_right",
442
454
  )
443
455
  user_id: Optional[Union[UUID, str]] = Field(
444
- default=None, description="User that created the Pipeline Run"
456
+ default=None,
457
+ description="User that created the Pipeline Run",
458
+ union_mode="left_to_right",
445
459
  )
446
460
  stack_id: Optional[Union[UUID, str]] = Field(
447
- default=None, description="Stack used for the Pipeline Run"
461
+ default=None,
462
+ description="Stack used for the Pipeline Run",
463
+ union_mode="left_to_right",
448
464
  )
449
465
  schedule_id: Optional[Union[UUID, str]] = Field(
450
- default=None, description="Schedule that triggered the Pipeline Run"
466
+ default=None,
467
+ description="Schedule that triggered the Pipeline Run",
468
+ union_mode="left_to_right",
451
469
  )
452
470
  build_id: Optional[Union[UUID, str]] = Field(
453
- default=None, description="Build used for the Pipeline Run"
471
+ default=None,
472
+ description="Build used for the Pipeline Run",
473
+ union_mode="left_to_right",
454
474
  )
455
475
  deployment_id: Optional[Union[UUID, str]] = Field(
456
- default=None, description="Deployment used for the Pipeline Run"
476
+ default=None,
477
+ description="Deployment used for the Pipeline Run",
478
+ union_mode="left_to_right",
457
479
  )
458
480
  code_repository_id: Optional[Union[UUID, str]] = Field(
459
- default=None, description="Code repository used for the Pipeline Run"
481
+ default=None,
482
+ description="Code repository used for the Pipeline Run",
483
+ union_mode="left_to_right",
460
484
  )
461
485
  status: Optional[str] = Field(
462
486
  default=None,
463
487
  description="Name of the Pipeline Run",
464
488
  )
465
489
  start_time: Optional[Union[datetime, str]] = Field(
466
- default=None, description="Start time for this run"
490
+ default=None,
491
+ description="Start time for this run",
492
+ union_mode="left_to_right",
467
493
  )
468
494
  end_time: Optional[Union[datetime, str]] = Field(
469
- default=None, description="End time for this run"
495
+ default=None,
496
+ description="End time for this run",
497
+ union_mode="left_to_right",
470
498
  )
471
499
  unlisted: Optional[bool] = None
472
500
 
473
501
  def get_custom_filters(
474
502
  self,
475
- ) -> List[Union["BinaryExpression[Any]", "BooleanClauseList[Any]"]]:
503
+ ) -> List["ColumnElement[bool]"]:
476
504
  """Get custom filters.
477
505
 
478
506
  Returns:
@@ -480,7 +508,7 @@ class PipelineRunFilter(WorkspaceScopedFilter):
480
508
  """
481
509
  custom_filters = super().get_custom_filters()
482
510
 
483
- from sqlalchemy import and_
511
+ from sqlmodel import and_
484
512
 
485
513
  from zenml.zen_stores.schemas import (
486
514
  CodeReferenceSchema,
@@ -506,14 +534,14 @@ class PipelineRunFilter(WorkspaceScopedFilter):
506
534
  column="name",
507
535
  value=value,
508
536
  )
509
- pipeline_name_filter = and_( # type: ignore[type-var]
537
+ pipeline_name_filter = and_(
510
538
  PipelineRunSchema.pipeline_id == PipelineSchema.id,
511
539
  filter_.generate_query_conditions(PipelineSchema),
512
540
  )
513
541
  custom_filters.append(pipeline_name_filter)
514
542
 
515
543
  if self.code_repository_id:
516
- code_repo_filter = and_( # type: ignore[type-var]
544
+ code_repo_filter = and_(
517
545
  PipelineRunSchema.deployment_id == PipelineDeploymentSchema.id,
518
546
  PipelineDeploymentSchema.code_reference_id
519
547
  == CodeReferenceSchema.id,
@@ -523,7 +551,7 @@ class PipelineRunFilter(WorkspaceScopedFilter):
523
551
  custom_filters.append(code_repo_filter)
524
552
 
525
553
  if self.stack_id:
526
- stack_filter = and_( # type: ignore[type-var]
554
+ stack_filter = and_(
527
555
  PipelineRunSchema.deployment_id == PipelineDeploymentSchema.id,
528
556
  PipelineDeploymentSchema.stack_id == StackSchema.id,
529
557
  StackSchema.id == self.stack_id,
@@ -531,7 +559,7 @@ class PipelineRunFilter(WorkspaceScopedFilter):
531
559
  custom_filters.append(stack_filter)
532
560
 
533
561
  if self.schedule_id:
534
- schedule_filter = and_( # type: ignore[type-var]
562
+ schedule_filter = and_(
535
563
  PipelineRunSchema.deployment_id == PipelineDeploymentSchema.id,
536
564
  PipelineDeploymentSchema.schedule_id == ScheduleSchema.id,
537
565
  ScheduleSchema.id == self.schedule_id,
@@ -539,7 +567,7 @@ class PipelineRunFilter(WorkspaceScopedFilter):
539
567
  custom_filters.append(schedule_filter)
540
568
 
541
569
  if self.build_id:
542
- pipeline_build_filter = and_( # type: ignore[type-var]
570
+ pipeline_build_filter = and_(
543
571
  PipelineRunSchema.deployment_id == PipelineDeploymentSchema.id,
544
572
  PipelineDeploymentSchema.build_id == PipelineBuildSchema.id,
545
573
  PipelineBuildSchema.id == self.build_id,
@@ -13,14 +13,15 @@
13
13
  # permissions and limitations under the License.
14
14
  """Models representing run metadata."""
15
15
 
16
- from typing import TYPE_CHECKING, Dict, Optional, Union
16
+ from typing import Any, Dict, Optional, Union
17
17
  from uuid import UUID
18
18
 
19
- from pydantic import Field
19
+ from pydantic import Field, field_validator
20
20
 
21
21
  from zenml.constants import STR_FIELD_MAX_LENGTH, TEXT_FIELD_MAX_LENGTH
22
22
  from zenml.enums import MetadataResourceTypes
23
23
  from zenml.metadata.metadata_types import MetadataType, MetadataTypeEnum
24
+ from zenml.model.model import Model
24
25
  from zenml.models.v2.base.scoped import (
25
26
  WorkspaceScopedFilter,
26
27
  WorkspaceScopedRequest,
@@ -30,9 +31,6 @@ from zenml.models.v2.base.scoped import (
30
31
  WorkspaceScopedResponseResources,
31
32
  )
32
33
 
33
- if TYPE_CHECKING:
34
- from zenml.model.model import Model
35
-
36
34
  # ------------------ Request Model ------------------
37
35
 
38
36
 
@@ -55,11 +53,6 @@ class RunMetadataRequest(WorkspaceScopedRequest):
55
53
  title="The types of the metadata to be created.",
56
54
  )
57
55
 
58
- class Config:
59
- """Pydantic configuration."""
60
-
61
- smart_union = True
62
-
63
56
 
64
57
  # ------------------ Update Model ------------------
65
58
 
@@ -71,23 +64,53 @@ class RunMetadataRequest(WorkspaceScopedRequest):
71
64
  class RunMetadataResponseBody(WorkspaceScopedResponseBody):
72
65
  """Response body for run metadata."""
73
66
 
74
- key: str = Field(
75
- title="The key of the metadata.",
76
- max_length=STR_FIELD_MAX_LENGTH,
77
- )
67
+ key: str = Field(title="The key of the metadata.")
78
68
  value: MetadataType = Field(
79
- title="The value of the metadata.",
80
- max_length=TEXT_FIELD_MAX_LENGTH,
81
- )
82
- type: MetadataTypeEnum = Field(
83
- title="The type of the metadata.",
84
- max_length=STR_FIELD_MAX_LENGTH,
69
+ title="The value of the metadata.", union_mode="smart"
85
70
  )
71
+ type: MetadataTypeEnum = Field(title="The type of the metadata.")
72
+
73
+ @field_validator("key", "type")
74
+ @classmethod
75
+ def str_field_max_length_check(cls, value: Any) -> Any:
76
+ """Checks if the length of the value exceeds the maximum str length.
77
+
78
+ Args:
79
+ value: the value set in the field
80
+
81
+ Returns:
82
+ the value itself.
83
+
84
+ Raises:
85
+ AssertionError: if the length of the field is longer than the
86
+ maximum threshold.
87
+ """
88
+ assert len(str(value)) < STR_FIELD_MAX_LENGTH, (
89
+ "The length of the value for this field can not "
90
+ f"exceed {STR_FIELD_MAX_LENGTH}"
91
+ )
92
+ return value
93
+
94
+ @field_validator("value")
95
+ @classmethod
96
+ def text_field_max_length_check(cls, value: Any) -> Any:
97
+ """Checks if the length of the value exceeds the maximum text length.
98
+
99
+ Args:
100
+ value: the value set in the field
86
101
 
87
- class Config:
88
- """Pydantic configuration."""
102
+ Returns:
103
+ the value itself.
89
104
 
90
- smart_union = True
105
+ Raises:
106
+ AssertionError: if the length of the field is longer than the
107
+ maximum threshold.
108
+ """
109
+ assert len(str(value)) < TEXT_FIELD_MAX_LENGTH, (
110
+ "The length of the value for this field can not "
111
+ f"exceed {TEXT_FIELD_MAX_LENGTH}"
112
+ )
113
+ return value
91
114
 
92
115
 
93
116
  class RunMetadataResponseMetadata(WorkspaceScopedResponseMetadata):
@@ -189,11 +212,17 @@ class RunMetadataResponse(
189
212
  class RunMetadataFilter(WorkspaceScopedFilter):
190
213
  """Model to enable advanced filtering of run metadata."""
191
214
 
192
- resource_id: Optional[Union[str, UUID]] = None
215
+ resource_id: Optional[Union[str, UUID]] = Field(
216
+ default=None, union_mode="left_to_right"
217
+ )
193
218
  resource_type: Optional[MetadataResourceTypes] = None
194
- stack_component_id: Optional[Union[str, UUID]] = None
219
+ stack_component_id: Optional[Union[str, UUID]] = Field(
220
+ default=None, union_mode="left_to_right"
221
+ )
195
222
  key: Optional[str] = None
196
- type: Optional[Union[str, MetadataTypeEnum]] = None
223
+ type: Optional[Union[str, MetadataTypeEnum]] = Field(
224
+ default=None, union_mode="left_to_right"
225
+ )
197
226
 
198
227
 
199
228
  # -------------------- Lazy Loader --------------------
@@ -207,10 +236,10 @@ class LazyRunMetadataResponse(RunMetadataResponse):
207
236
  """
208
237
 
209
238
  id: Optional[UUID] = None # type: ignore[assignment]
210
- _lazy_load_artifact_name: Optional[str] = None
211
- _lazy_load_artifact_version: Optional[str] = None
212
- _lazy_load_metadata_name: Optional[str] = None
213
- _lazy_load_model: "Model"
239
+ lazy_load_artifact_name: Optional[str] = None
240
+ lazy_load_artifact_version: Optional[str] = None
241
+ lazy_load_metadata_name: Optional[str] = None
242
+ lazy_load_model: Model
214
243
 
215
244
  def get_body(self) -> None: # type: ignore[override]
216
245
  """Protects from misuse of the lazy loader.
@@ -231,9 +260,3 @@ class LazyRunMetadataResponse(RunMetadataResponse):
231
260
  raise RuntimeError(
232
261
  "Cannot access run metadata metadata before pipeline runs."
233
262
  )
234
-
235
- class Config:
236
- """Pydantic configuration class."""
237
-
238
- # Allow extras to include the lazy load attributes
239
- extra = "allow"