zenml-nightly 0.58.2.dev20240614__py3-none-any.whl → 0.58.2.dev20240622__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 (314) 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/base.py +2 -2
  13. zenml/cli/served_model.py +0 -1
  14. zenml/cli/server.py +3 -3
  15. zenml/cli/utils.py +36 -40
  16. zenml/cli/web_login.py +2 -2
  17. zenml/client.py +198 -24
  18. zenml/client_lazy_loader.py +20 -14
  19. zenml/config/base_settings.py +5 -6
  20. zenml/config/build_configuration.py +1 -1
  21. zenml/config/compiler.py +3 -3
  22. zenml/config/docker_settings.py +27 -28
  23. zenml/config/global_config.py +33 -37
  24. zenml/config/pipeline_configurations.py +8 -11
  25. zenml/config/pipeline_run_configuration.py +6 -2
  26. zenml/config/pipeline_spec.py +3 -4
  27. zenml/config/resource_settings.py +8 -9
  28. zenml/config/schedule.py +16 -20
  29. zenml/config/secret_reference_mixin.py +6 -3
  30. zenml/config/secrets_store_config.py +16 -23
  31. zenml/config/server_config.py +50 -46
  32. zenml/config/settings_resolver.py +1 -1
  33. zenml/config/source.py +45 -35
  34. zenml/config/step_configurations.py +53 -31
  35. zenml/config/step_run_info.py +3 -0
  36. zenml/config/store_config.py +20 -19
  37. zenml/config/strict_base_model.py +2 -6
  38. zenml/constants.py +26 -2
  39. zenml/container_registries/base_container_registry.py +3 -2
  40. zenml/container_registries/default_container_registry.py +3 -3
  41. zenml/event_hub/base_event_hub.py +1 -1
  42. zenml/event_sources/base_event_source.py +11 -16
  43. zenml/exceptions.py +4 -0
  44. zenml/integrations/airflow/__init__.py +2 -6
  45. zenml/integrations/airflow/flavors/airflow_orchestrator_flavor.py +6 -7
  46. zenml/integrations/airflow/orchestrators/airflow_orchestrator.py +13 -249
  47. zenml/integrations/airflow/orchestrators/dag_generator.py +5 -3
  48. zenml/integrations/argilla/flavors/argilla_annotator_flavor.py +5 -4
  49. zenml/integrations/aws/__init__.py +1 -1
  50. zenml/integrations/aws/flavors/aws_container_registry_flavor.py +3 -2
  51. zenml/integrations/aws/flavors/sagemaker_orchestrator_flavor.py +11 -5
  52. zenml/integrations/aws/flavors/sagemaker_step_operator_flavor.py +6 -2
  53. zenml/integrations/aws/service_connectors/aws_service_connector.py +5 -4
  54. zenml/integrations/aws/step_operators/sagemaker_step_operator.py +1 -1
  55. zenml/integrations/azure/flavors/azureml_step_operator_flavor.py +4 -4
  56. zenml/integrations/azure/service_connectors/azure_service_connector.py +4 -3
  57. zenml/integrations/azure/step_operators/azureml_step_operator.py +2 -1
  58. zenml/integrations/bentoml/steps/bentoml_deployer.py +1 -1
  59. zenml/integrations/bitbucket/plugins/event_sources/bitbucket_webhook_event_source.py +8 -12
  60. zenml/integrations/comet/flavors/comet_experiment_tracker_flavor.py +1 -1
  61. zenml/integrations/constants.py +0 -1
  62. zenml/integrations/deepchecks/__init__.py +1 -0
  63. zenml/integrations/evidently/__init__.py +5 -3
  64. zenml/integrations/evidently/column_mapping.py +11 -3
  65. zenml/integrations/evidently/data_validators/evidently_data_validator.py +21 -3
  66. zenml/integrations/evidently/metrics.py +5 -6
  67. zenml/integrations/evidently/tests.py +5 -6
  68. zenml/integrations/facets/models.py +2 -6
  69. zenml/integrations/feast/__init__.py +3 -1
  70. zenml/integrations/feast/feature_stores/feast_feature_store.py +0 -23
  71. zenml/integrations/gcp/__init__.py +1 -1
  72. zenml/integrations/gcp/flavors/vertex_orchestrator_flavor.py +1 -1
  73. zenml/integrations/gcp/flavors/vertex_step_operator_flavor.py +1 -1
  74. zenml/integrations/gcp/orchestrators/vertex_orchestrator.py +234 -103
  75. zenml/integrations/gcp/service_connectors/gcp_service_connector.py +57 -42
  76. zenml/integrations/gcp/step_operators/vertex_step_operator.py +1 -0
  77. zenml/integrations/github/code_repositories/github_code_repository.py +1 -1
  78. zenml/integrations/github/plugins/event_sources/github_webhook_event_source.py +9 -13
  79. zenml/integrations/great_expectations/__init__.py +1 -1
  80. zenml/integrations/great_expectations/data_validators/ge_data_validator.py +44 -44
  81. zenml/integrations/great_expectations/flavors/great_expectations_data_validator_flavor.py +35 -2
  82. zenml/integrations/great_expectations/ge_store_backend.py +24 -11
  83. zenml/integrations/great_expectations/materializers/ge_materializer.py +3 -3
  84. zenml/integrations/great_expectations/utils.py +5 -5
  85. zenml/integrations/huggingface/__init__.py +3 -0
  86. zenml/integrations/huggingface/flavors/huggingface_model_deployer_flavor.py +1 -1
  87. zenml/integrations/huggingface/steps/__init__.py +3 -0
  88. zenml/integrations/huggingface/steps/accelerate_runner.py +149 -0
  89. zenml/integrations/huggingface/steps/huggingface_deployer.py +2 -2
  90. zenml/integrations/hyperai/flavors/hyperai_orchestrator_flavor.py +1 -1
  91. zenml/integrations/hyperai/service_connectors/hyperai_service_connector.py +4 -3
  92. zenml/integrations/kubeflow/__init__.py +1 -1
  93. zenml/integrations/kubeflow/flavors/kubeflow_orchestrator_flavor.py +48 -81
  94. zenml/integrations/kubeflow/orchestrators/kubeflow_orchestrator.py +295 -245
  95. zenml/integrations/kubernetes/flavors/kubernetes_orchestrator_flavor.py +1 -1
  96. zenml/integrations/kubernetes/orchestrators/kubernetes_orchestrator_entrypoint.py +11 -2
  97. zenml/integrations/kubernetes/pod_settings.py +17 -31
  98. zenml/integrations/kubernetes/service_connectors/kubernetes_service_connector.py +8 -7
  99. zenml/integrations/label_studio/__init__.py +1 -3
  100. zenml/integrations/label_studio/annotators/label_studio_annotator.py +3 -4
  101. zenml/integrations/label_studio/flavors/label_studio_annotator_flavor.py +2 -2
  102. zenml/integrations/langchain/__init__.py +5 -1
  103. zenml/integrations/langchain/materializers/document_materializer.py +44 -8
  104. zenml/integrations/mlflow/__init__.py +9 -3
  105. zenml/integrations/mlflow/experiment_trackers/mlflow_experiment_tracker.py +1 -1
  106. zenml/integrations/mlflow/flavors/mlflow_experiment_tracker_flavor.py +29 -37
  107. zenml/integrations/mlflow/model_registries/mlflow_model_registry.py +4 -4
  108. zenml/integrations/mlflow/steps/mlflow_deployer.py +1 -1
  109. zenml/integrations/neptune/flavors/neptune_experiment_tracker_flavor.py +1 -1
  110. zenml/integrations/neural_prophet/__init__.py +5 -1
  111. zenml/integrations/pigeon/flavors/pigeon_annotator_flavor.py +1 -1
  112. zenml/integrations/s3/flavors/s3_artifact_store_flavor.py +9 -8
  113. zenml/integrations/seldon/seldon_client.py +52 -67
  114. zenml/integrations/seldon/services/seldon_deployment.py +3 -3
  115. zenml/integrations/seldon/steps/seldon_deployer.py +4 -4
  116. zenml/integrations/skypilot/flavors/skypilot_orchestrator_base_vm_config.py +15 -5
  117. zenml/integrations/skypilot_aws/__init__.py +1 -1
  118. zenml/integrations/skypilot_aws/flavors/skypilot_orchestrator_aws_vm_flavor.py +1 -1
  119. zenml/integrations/skypilot_azure/__init__.py +1 -1
  120. zenml/integrations/skypilot_azure/flavors/skypilot_orchestrator_azure_vm_flavor.py +1 -1
  121. zenml/integrations/skypilot_gcp/__init__.py +2 -1
  122. zenml/integrations/skypilot_gcp/flavors/skypilot_orchestrator_gcp_vm_flavor.py +1 -1
  123. zenml/integrations/skypilot_lambda/flavors/skypilot_orchestrator_lambda_vm_flavor.py +2 -2
  124. zenml/integrations/spark/flavors/spark_step_operator_flavor.py +1 -1
  125. zenml/integrations/spark/step_operators/spark_step_operator.py +2 -0
  126. zenml/integrations/tekton/__init__.py +1 -1
  127. zenml/integrations/tekton/flavors/tekton_orchestrator_flavor.py +66 -23
  128. zenml/integrations/tekton/orchestrators/tekton_orchestrator.py +547 -233
  129. zenml/integrations/tensorboard/__init__.py +1 -12
  130. zenml/integrations/tensorboard/services/tensorboard_service.py +3 -5
  131. zenml/integrations/tensorboard/visualizers/tensorboard_visualizer.py +6 -6
  132. zenml/integrations/tensorflow/__init__.py +2 -10
  133. zenml/integrations/tensorflow/materializers/keras_materializer.py +17 -9
  134. zenml/integrations/wandb/flavors/wandb_experiment_tracker_flavor.py +9 -14
  135. zenml/integrations/whylogs/flavors/whylogs_data_validator_flavor.py +1 -1
  136. zenml/lineage_graph/lineage_graph.py +1 -1
  137. zenml/logging/step_logging.py +15 -7
  138. zenml/materializers/built_in_materializer.py +3 -3
  139. zenml/materializers/pydantic_materializer.py +2 -2
  140. zenml/metadata/lazy_load.py +4 -4
  141. zenml/metadata/metadata_types.py +64 -4
  142. zenml/model/model.py +79 -54
  143. zenml/model_deployers/base_model_deployer.py +14 -12
  144. zenml/model_registries/base_model_registry.py +17 -15
  145. zenml/models/__init__.py +79 -206
  146. zenml/models/v2/base/base.py +54 -41
  147. zenml/models/v2/base/base_plugin_flavor.py +2 -6
  148. zenml/models/v2/base/filter.py +91 -76
  149. zenml/models/v2/base/page.py +2 -12
  150. zenml/models/v2/base/scoped.py +4 -7
  151. zenml/models/v2/core/api_key.py +22 -8
  152. zenml/models/v2/core/artifact.py +2 -2
  153. zenml/models/v2/core/artifact_version.py +74 -40
  154. zenml/models/v2/core/code_repository.py +37 -10
  155. zenml/models/v2/core/component.py +65 -16
  156. zenml/models/v2/core/device.py +14 -4
  157. zenml/models/v2/core/event_source.py +1 -2
  158. zenml/models/v2/core/flavor.py +74 -8
  159. zenml/models/v2/core/logs.py +68 -8
  160. zenml/models/v2/core/model.py +8 -4
  161. zenml/models/v2/core/model_version.py +25 -6
  162. zenml/models/v2/core/model_version_artifact.py +51 -21
  163. zenml/models/v2/core/model_version_pipeline_run.py +45 -13
  164. zenml/models/v2/core/pipeline.py +37 -72
  165. zenml/models/v2/core/pipeline_build.py +29 -17
  166. zenml/models/v2/core/pipeline_deployment.py +18 -6
  167. zenml/models/v2/core/pipeline_namespace.py +113 -0
  168. zenml/models/v2/core/pipeline_run.py +50 -22
  169. zenml/models/v2/core/run_metadata.py +59 -36
  170. zenml/models/v2/core/schedule.py +37 -24
  171. zenml/models/v2/core/secret.py +31 -12
  172. zenml/models/v2/core/service.py +64 -36
  173. zenml/models/v2/core/service_account.py +24 -11
  174. zenml/models/v2/core/service_connector.py +219 -44
  175. zenml/models/v2/core/stack.py +45 -17
  176. zenml/models/v2/core/step_run.py +28 -8
  177. zenml/models/v2/core/tag.py +8 -4
  178. zenml/models/v2/core/trigger.py +2 -2
  179. zenml/models/v2/core/trigger_execution.py +1 -0
  180. zenml/models/v2/core/user.py +18 -21
  181. zenml/models/v2/core/workspace.py +13 -3
  182. zenml/models/v2/misc/build_item.py +3 -3
  183. zenml/models/v2/misc/external_user.py +2 -6
  184. zenml/models/v2/misc/hub_plugin_models.py +9 -9
  185. zenml/models/v2/misc/loaded_visualization.py +2 -2
  186. zenml/models/v2/misc/service_connector_type.py +8 -17
  187. zenml/models/v2/misc/user_auth.py +7 -2
  188. zenml/new/pipelines/build_utils.py +3 -3
  189. zenml/new/pipelines/pipeline.py +17 -13
  190. zenml/new/pipelines/run_utils.py +103 -1
  191. zenml/orchestrators/base_orchestrator.py +10 -7
  192. zenml/orchestrators/local_docker/local_docker_orchestrator.py +1 -1
  193. zenml/orchestrators/step_launcher.py +28 -4
  194. zenml/orchestrators/step_runner.py +3 -6
  195. zenml/orchestrators/utils.py +1 -1
  196. zenml/plugins/base_plugin_flavor.py +6 -10
  197. zenml/plugins/plugin_flavor_registry.py +3 -7
  198. zenml/secret/base_secret.py +7 -8
  199. zenml/service_connectors/docker_service_connector.py +4 -3
  200. zenml/service_connectors/service_connector.py +5 -12
  201. zenml/service_connectors/service_connector_registry.py +2 -4
  202. zenml/services/container/container_service.py +1 -1
  203. zenml/services/container/container_service_endpoint.py +1 -1
  204. zenml/services/local/local_service.py +1 -1
  205. zenml/services/local/local_service_endpoint.py +1 -1
  206. zenml/services/service.py +16 -10
  207. zenml/services/service_type.py +4 -5
  208. zenml/services/terraform/terraform_service.py +1 -1
  209. zenml/stack/flavor.py +2 -6
  210. zenml/stack/flavor_registry.py +4 -4
  211. zenml/stack/stack.py +4 -1
  212. zenml/stack/stack_component.py +55 -31
  213. zenml/step_operators/step_operator_entrypoint_configuration.py +1 -0
  214. zenml/steps/base_step.py +34 -28
  215. zenml/steps/entrypoint_function_utils.py +3 -5
  216. zenml/steps/utils.py +12 -14
  217. zenml/utils/cuda_utils.py +50 -0
  218. zenml/utils/deprecation_utils.py +18 -20
  219. zenml/utils/dict_utils.py +1 -1
  220. zenml/utils/filesync_model.py +65 -28
  221. zenml/utils/function_utils.py +260 -0
  222. zenml/utils/json_utils.py +131 -0
  223. zenml/utils/mlstacks_utils.py +2 -2
  224. zenml/utils/package_utils.py +1 -1
  225. zenml/utils/pipeline_docker_image_builder.py +9 -0
  226. zenml/utils/pydantic_utils.py +270 -62
  227. zenml/utils/secret_utils.py +65 -12
  228. zenml/utils/source_utils.py +2 -2
  229. zenml/utils/typed_model.py +5 -3
  230. zenml/utils/typing_utils.py +243 -0
  231. zenml/utils/yaml_utils.py +1 -1
  232. zenml/zen_server/auth.py +2 -2
  233. zenml/zen_server/cloud_utils.py +6 -6
  234. zenml/zen_server/deploy/base_provider.py +1 -1
  235. zenml/zen_server/deploy/deployment.py +6 -8
  236. zenml/zen_server/deploy/docker/docker_zen_server.py +3 -4
  237. zenml/zen_server/deploy/local/local_provider.py +0 -1
  238. zenml/zen_server/deploy/local/local_zen_server.py +6 -6
  239. zenml/zen_server/deploy/terraform/terraform_zen_server.py +4 -6
  240. zenml/zen_server/exceptions.py +4 -1
  241. zenml/zen_server/feature_gate/zenml_cloud_feature_gate.py +1 -1
  242. zenml/zen_server/pipeline_deployment/utils.py +48 -68
  243. zenml/zen_server/rbac/models.py +2 -5
  244. zenml/zen_server/rbac/utils.py +11 -14
  245. zenml/zen_server/routers/auth_endpoints.py +2 -2
  246. zenml/zen_server/routers/pipeline_builds_endpoints.py +1 -1
  247. zenml/zen_server/routers/runs_endpoints.py +1 -1
  248. zenml/zen_server/routers/secrets_endpoints.py +3 -2
  249. zenml/zen_server/routers/server_endpoints.py +1 -1
  250. zenml/zen_server/routers/steps_endpoints.py +1 -1
  251. zenml/zen_server/routers/workspaces_endpoints.py +1 -1
  252. zenml/zen_stores/base_zen_store.py +46 -9
  253. zenml/zen_stores/migrations/utils.py +42 -46
  254. zenml/zen_stores/migrations/versions/0701da9951a0_added_service_table.py +1 -1
  255. zenml/zen_stores/migrations/versions/1041bc644e0d_remove_secrets_manager.py +5 -3
  256. zenml/zen_stores/migrations/versions/10a907dad202_delete_mlmd_tables.py +1 -1
  257. zenml/zen_stores/migrations/versions/26b776ad583e_redesign_artifacts.py +8 -10
  258. zenml/zen_stores/migrations/versions/37835ce041d2_optimizing_database.py +3 -3
  259. zenml/zen_stores/migrations/versions/46506f72f0ed_add_server_settings.py +10 -12
  260. zenml/zen_stores/migrations/versions/5994f9ad0489_introduce_role_permissions.py +3 -2
  261. zenml/zen_stores/migrations/versions/6917bce75069_add_pipeline_run_unique_constraint.py +4 -4
  262. zenml/zen_stores/migrations/versions/728c6369cfaa_add_name_column_to_input_artifact_pk.py +3 -2
  263. zenml/zen_stores/migrations/versions/743ec82b1b3c_update_size_of_build_images.py +2 -2
  264. zenml/zen_stores/migrations/versions/7500f434b71c_remove_shared_columns.py +3 -2
  265. zenml/zen_stores/migrations/versions/7834208cc3f6_artifact_project_scoping.py +8 -7
  266. zenml/zen_stores/migrations/versions/7b651bf6822e_track_secrets_in_db.py +6 -4
  267. zenml/zen_stores/migrations/versions/7e4a481d17f7_add_identity_table.py +2 -2
  268. zenml/zen_stores/migrations/versions/7f603e583dd7_fixed_migration.py +1 -1
  269. zenml/zen_stores/migrations/versions/a39c4184c8ce_remove_secrets_manager_flavors.py +2 -2
  270. zenml/zen_stores/migrations/versions/a91762e6be36_artifact_version_table.py +4 -4
  271. zenml/zen_stores/migrations/versions/alembic_start.py +1 -1
  272. zenml/zen_stores/migrations/versions/fbd7f18ced1e_increase_step_run_field_lengths.py +4 -4
  273. zenml/zen_stores/rest_zen_store.py +109 -49
  274. zenml/zen_stores/schemas/api_key_schemas.py +1 -1
  275. zenml/zen_stores/schemas/artifact_schemas.py +8 -8
  276. zenml/zen_stores/schemas/artifact_visualization_schemas.py +3 -3
  277. zenml/zen_stores/schemas/code_repository_schemas.py +1 -1
  278. zenml/zen_stores/schemas/component_schemas.py +8 -3
  279. zenml/zen_stores/schemas/device_schemas.py +8 -6
  280. zenml/zen_stores/schemas/event_source_schemas.py +3 -4
  281. zenml/zen_stores/schemas/flavor_schemas.py +5 -3
  282. zenml/zen_stores/schemas/model_schemas.py +26 -1
  283. zenml/zen_stores/schemas/pipeline_build_schemas.py +1 -1
  284. zenml/zen_stores/schemas/pipeline_deployment_schemas.py +4 -4
  285. zenml/zen_stores/schemas/pipeline_run_schemas.py +6 -6
  286. zenml/zen_stores/schemas/pipeline_schemas.py +5 -2
  287. zenml/zen_stores/schemas/run_metadata_schemas.py +2 -2
  288. zenml/zen_stores/schemas/secret_schemas.py +8 -5
  289. zenml/zen_stores/schemas/server_settings_schemas.py +3 -1
  290. zenml/zen_stores/schemas/service_connector_schemas.py +1 -1
  291. zenml/zen_stores/schemas/service_schemas.py +11 -2
  292. zenml/zen_stores/schemas/stack_schemas.py +1 -1
  293. zenml/zen_stores/schemas/step_run_schemas.py +11 -11
  294. zenml/zen_stores/schemas/tag_schemas.py +6 -2
  295. zenml/zen_stores/schemas/trigger_schemas.py +2 -2
  296. zenml/zen_stores/schemas/user_schemas.py +2 -2
  297. zenml/zen_stores/schemas/workspace_schemas.py +3 -1
  298. zenml/zen_stores/secrets_stores/aws_secrets_store.py +19 -20
  299. zenml/zen_stores/secrets_stores/azure_secrets_store.py +17 -20
  300. zenml/zen_stores/secrets_stores/base_secrets_store.py +79 -12
  301. zenml/zen_stores/secrets_stores/gcp_secrets_store.py +17 -20
  302. zenml/zen_stores/secrets_stores/hashicorp_secrets_store.py +4 -8
  303. zenml/zen_stores/secrets_stores/service_connector_secrets_store.py +10 -7
  304. zenml/zen_stores/secrets_stores/sql_secrets_store.py +5 -6
  305. zenml/zen_stores/sql_zen_store.py +196 -120
  306. zenml/zen_stores/zen_store_interface.py +33 -0
  307. {zenml_nightly-0.58.2.dev20240614.dist-info → zenml_nightly-0.58.2.dev20240622.dist-info}/METADATA +9 -7
  308. {zenml_nightly-0.58.2.dev20240614.dist-info → zenml_nightly-0.58.2.dev20240622.dist-info}/RECORD +311 -308
  309. zenml/integrations/kubeflow/utils.py +0 -95
  310. zenml/models/v2/base/internal.py +0 -37
  311. zenml/models/v2/base/update.py +0 -44
  312. {zenml_nightly-0.58.2.dev20240614.dist-info → zenml_nightly-0.58.2.dev20240622.dist-info}/LICENSE +0 -0
  313. {zenml_nightly-0.58.2.dev20240614.dist-info → zenml_nightly-0.58.2.dev20240622.dist-info}/WHEEL +0 -0
  314. {zenml_nightly-0.58.2.dev20240614.dist-info → zenml_nightly-0.58.2.dev20240622.dist-info}/entry_points.txt +0 -0
@@ -27,7 +27,7 @@ from typing import (
27
27
  )
28
28
  from uuid import UUID
29
29
 
30
- from pydantic import BaseModel, Field, root_validator
30
+ from pydantic import BaseModel, ConfigDict, Field, model_validator
31
31
 
32
32
  from zenml.constants import STR_FIELD_MAX_LENGTH
33
33
  from zenml.models.v2.base.base import (
@@ -171,15 +171,12 @@ class UserRequest(UserBase, BaseRequest):
171
171
  )
172
172
  active: bool = Field(default=False, title="Whether the account is active.")
173
173
 
174
- class Config:
175
- """Pydantic configuration class."""
176
-
174
+ model_config = ConfigDict(
177
175
  # Validate attributes when assigning them
178
- validate_assignment = True
179
-
176
+ validate_assignment=True,
180
177
  # Forbid extra attributes to prevent unexpected behavior
181
- extra = "forbid"
182
- underscore_attrs_are_private = True
178
+ extra="forbid",
179
+ )
183
180
 
184
181
 
185
182
  # ------------------ Update Model ------------------
@@ -213,13 +210,10 @@ class UserUpdate(UserBase, BaseZenModel):
213
210
  max_length=STR_FIELD_MAX_LENGTH,
214
211
  )
215
212
 
216
- @root_validator
217
- def user_email_updates(cls, values: Dict[str, Any]) -> Dict[str, Any]:
213
+ @model_validator(mode="after")
214
+ def user_email_updates(self) -> "UserUpdate":
218
215
  """Validate that the UserUpdateModel conforms to the email-opt-in-flow.
219
216
 
220
- Args:
221
- values: The values to validate.
222
-
223
217
  Returns:
224
218
  The validated values.
225
219
 
@@ -229,18 +223,18 @@ class UserUpdate(UserBase, BaseZenModel):
229
223
  """
230
224
  # When someone sets the email, or updates the email and hasn't
231
225
  # before explicitly opted out, they are opted in
232
- if values["email"] is not None:
233
- if values["email_opted_in"] is None:
234
- values["email_opted_in"] = True
226
+ if self.email is not None:
227
+ if self.email_opted_in is None:
228
+ self.email_opted_in = True
235
229
 
236
230
  # It should not be possible to do opt in without an email
237
- if values["email_opted_in"] is True:
238
- if values["email"] is None:
231
+ if self.email_opted_in is True:
232
+ if self.email is None:
239
233
  raise ValueError(
240
234
  "Please provide an email, when you are opting-in with "
241
235
  "your email."
242
236
  )
243
- return values
237
+ return self
244
238
 
245
239
  def create_copy(self, exclude: AbstractSet[str]) -> "UserUpdate":
246
240
  """Create a copy of the current instance.
@@ -252,9 +246,9 @@ class UserUpdate(UserBase, BaseZenModel):
252
246
  A copy of the current instance.
253
247
  """
254
248
  return UserUpdate(
255
- **self.dict(
249
+ **self.model_dump(
250
+ exclude=set(exclude),
256
251
  exclude_unset=True,
257
- exclude=exclude,
258
252
  )
259
253
  )
260
254
 
@@ -483,14 +477,17 @@ class UserFilter(BaseFilter):
483
477
  active: Optional[Union[bool, str]] = Field(
484
478
  default=None,
485
479
  description="Whether the user is active",
480
+ union_mode="left_to_right",
486
481
  )
487
482
  email_opted_in: Optional[Union[bool, str]] = Field(
488
483
  default=None,
489
484
  description="Whether the user has opted in to emails",
485
+ union_mode="left_to_right",
490
486
  )
491
487
  external_user_id: Optional[Union[UUID, str]] = Field(
492
488
  default=None,
493
489
  title="The external user ID associated with the account.",
490
+ union_mode="left_to_right",
494
491
  )
495
492
 
496
493
  def apply_filter(
@@ -24,9 +24,9 @@ from zenml.models.v2.base.base import (
24
24
  BaseRequest,
25
25
  BaseResponseMetadata,
26
26
  BaseResponseResources,
27
+ BaseUpdate,
27
28
  )
28
29
  from zenml.models.v2.base.filter import BaseFilter
29
- from zenml.models.v2.base.update import update_model
30
30
 
31
31
  # ------------------ Request Model ------------------
32
32
 
@@ -48,10 +48,20 @@ class WorkspaceRequest(BaseRequest):
48
48
  # ------------------ Update Model ------------------
49
49
 
50
50
 
51
- @update_model
52
- class WorkspaceUpdate(WorkspaceRequest):
51
+ class WorkspaceUpdate(BaseUpdate):
53
52
  """Update model for workspaces."""
54
53
 
54
+ name: Optional[str] = Field(
55
+ title="The unique name of the workspace.",
56
+ max_length=STR_FIELD_MAX_LENGTH,
57
+ default=None,
58
+ )
59
+ description: Optional[str] = Field(
60
+ title="The description of the workspace.",
61
+ max_length=STR_FIELD_MAX_LENGTH,
62
+ default=None,
63
+ )
64
+
55
65
 
56
66
  # ------------------ Response Model ------------------
57
67
 
@@ -33,13 +33,13 @@ class BuildItem(BaseModel):
33
33
 
34
34
  image: str = Field(title="The image name or digest.")
35
35
  dockerfile: Optional[str] = Field(
36
- title="The dockerfile used to build the image."
36
+ default=None, title="The dockerfile used to build the image."
37
37
  )
38
38
  requirements: Optional[str] = Field(
39
- title="The pip requirements installed in the image."
39
+ default=None, title="The pip requirements installed in the image."
40
40
  )
41
41
  settings_checksum: Optional[str] = Field(
42
- title="The checksum of the build settings."
42
+ default=None, title="The checksum of the build settings."
43
43
  )
44
44
  contains_code: bool = Field(
45
45
  default=True, title="Whether the image contains user files."
@@ -16,7 +16,7 @@
16
16
  from typing import Optional
17
17
  from uuid import UUID
18
18
 
19
- from pydantic import BaseModel
19
+ from pydantic import BaseModel, ConfigDict
20
20
 
21
21
 
22
22
  class ExternalUserModel(BaseModel):
@@ -27,8 +27,4 @@ class ExternalUserModel(BaseModel):
27
27
  name: Optional[str] = None
28
28
  is_admin: bool = False
29
29
 
30
- class Config:
31
- """Pydantic configuration."""
32
-
33
- # ignore arbitrary fields
34
- extra = "ignore"
30
+ model_config = ConfigDict(extra="ignore")
@@ -42,22 +42,22 @@ class HubUserResponseModel(BaseModel):
42
42
 
43
43
  id: UUID
44
44
  email: str
45
- username: Optional[str]
45
+ username: Optional[str] = None
46
46
 
47
47
 
48
48
  class HubPluginBaseModel(BaseModel):
49
49
  """Base model for a ZenML Hub plugin."""
50
50
 
51
51
  name: str
52
- description: Optional[str]
53
- version: Optional[str]
54
- release_notes: Optional[str]
52
+ description: Optional[str] = None
53
+ version: Optional[str] = None
54
+ release_notes: Optional[str] = None
55
55
  repository_url: str
56
- repository_subdirectory: Optional[str]
57
- repository_branch: Optional[str]
58
- repository_commit: Optional[str]
59
- tags: Optional[List[str]]
60
- logo_url: Optional[str]
56
+ repository_subdirectory: Optional[str] = None
57
+ repository_branch: Optional[str] = None
58
+ repository_commit: Optional[str] = None
59
+ tags: Optional[List[str]] = None
60
+ logo_url: Optional[str] = None
61
61
 
62
62
 
63
63
  class HubPluginRequestModel(HubPluginBaseModel):
@@ -15,7 +15,7 @@
15
15
 
16
16
  from typing import Union
17
17
 
18
- from pydantic import BaseModel
18
+ from pydantic import BaseModel, Field
19
19
 
20
20
  from zenml.enums import VisualizationType
21
21
 
@@ -24,4 +24,4 @@ class LoadedVisualization(BaseModel):
24
24
  """Model for loaded visualizations."""
25
25
 
26
26
  type: VisualizationType
27
- value: Union[str, bytes]
27
+ value: Union[str, bytes] = Field(union_mode="left_to_right")
@@ -13,11 +13,10 @@
13
13
  # permissions and limitations under the License.
14
14
  """Model definitions for ZenML service connectors."""
15
15
 
16
- import json
17
16
  from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Type, Union
18
17
  from uuid import UUID
19
18
 
20
- from pydantic import BaseModel, Field, validator
19
+ from pydantic import BaseModel, Field, field_validator
21
20
 
22
21
  from zenml.constants import STR_FIELD_MAX_LENGTH
23
22
  from zenml.logger import get_logger
@@ -141,7 +140,8 @@ class AuthenticationMethodModel(BaseModel):
141
140
  **values: The data to initialize the authentication method with.
142
141
  """
143
142
  if config_class:
144
- values["config_schema"] = json.loads(config_class.schema_json())
143
+ values["config_schema"] = config_class.model_json_schema()
144
+
145
145
  super().__init__(**values)
146
146
  self._config_class = config_class
147
147
 
@@ -215,11 +215,6 @@ class AuthenticationMethodModel(BaseModel):
215
215
 
216
216
  return expiration_seconds
217
217
 
218
- class Config:
219
- """Pydantic config class."""
220
-
221
- underscore_attrs_are_private = True
222
-
223
218
 
224
219
  class ServiceConnectorTypeModel(BaseModel):
225
220
  """Service connector type specification.
@@ -333,7 +328,8 @@ class ServiceConnectorTypeModel(BaseModel):
333
328
  """
334
329
  self._connector_class = connector_class
335
330
 
336
- @validator("resource_types")
331
+ @field_validator("resource_types")
332
+ @classmethod
337
333
  def validate_resource_types(
338
334
  cls, values: List[ResourceTypeModel]
339
335
  ) -> List[ResourceTypeModel]:
@@ -360,7 +356,8 @@ class ServiceConnectorTypeModel(BaseModel):
360
356
 
361
357
  return values
362
358
 
363
- @validator("auth_methods")
359
+ @field_validator("auth_methods")
360
+ @classmethod
364
361
  def validate_auth_methods(
365
362
  cls, values: List[AuthenticationMethodModel]
366
363
  ) -> List[AuthenticationMethodModel]:
@@ -472,11 +469,6 @@ class ServiceConnectorTypeModel(BaseModel):
472
469
 
473
470
  return auth_method_spec, resource_type_spec
474
471
 
475
- class Config:
476
- """Pydantic config class."""
477
-
478
- underscore_attrs_are_private = True
479
-
480
472
 
481
473
  class ServiceConnectorRequirements(BaseModel):
482
474
  """Service connector requirements.
@@ -600,8 +592,7 @@ class ServiceConnectorResourcesModel(BaseModel):
600
592
  )
601
593
 
602
594
  connector_type: Union[str, "ServiceConnectorTypeModel"] = Field(
603
- title="The type of service connector.",
604
- max_length=STR_FIELD_MAX_LENGTH,
595
+ title="The type of service connector.", union_mode="left_to_right"
605
596
  )
606
597
 
607
598
  resources: List[ServiceConnectorTypedResourcesModel] = Field(
@@ -22,6 +22,7 @@ from pydantic import Field, SecretStr
22
22
 
23
23
  from zenml.constants import STR_FIELD_MAX_LENGTH
24
24
  from zenml.models.v2.base.base import BaseZenModel
25
+ from zenml.utils.secret_utils import PlainSerializedSecretStr
25
26
 
26
27
  if TYPE_CHECKING:
27
28
  from passlib.context import CryptContext
@@ -47,8 +48,12 @@ class UserAuthModel(BaseZenModel):
47
48
  "account."
48
49
  )
49
50
 
50
- activation_token: Optional[SecretStr] = Field(default=None, exclude=True)
51
- password: Optional[SecretStr] = Field(default=None, exclude=True)
51
+ activation_token: Optional[PlainSerializedSecretStr] = Field(
52
+ default=None, exclude=True
53
+ )
54
+ password: Optional[PlainSerializedSecretStr] = Field(
55
+ default=None, exclude=True
56
+ )
52
57
  name: str = Field(
53
58
  title="The unique username for the account.",
54
59
  max_length=STR_FIELD_MAX_LENGTH,
@@ -62,7 +62,7 @@ def _create_deployment(
62
62
 
63
63
  Args:
64
64
  deployment: Base of the deployment to create.
65
- pipeline_id: Pipeline ID to use for the deloyment.
65
+ pipeline_id: Pipeline ID to use for the deployment.
66
66
  code_repository: Code repository to use for the deployment.
67
67
 
68
68
  Returns:
@@ -93,7 +93,7 @@ def _create_deployment(
93
93
  stack=Client().active_stack.id,
94
94
  pipeline=pipeline_id,
95
95
  code_reference=code_reference,
96
- **deployment.dict(),
96
+ **deployment.model_dump(),
97
97
  )
98
98
  return (
99
99
  Client().zen_store.create_deployment(deployment=deployment_request).id
@@ -184,7 +184,7 @@ def reuse_or_create_pipeline_build(
184
184
  workspace=Client().active_workspace.id,
185
185
  stack=Client().active_stack_model.id,
186
186
  pipeline=pipeline_id,
187
- **build.dict(),
187
+ **build.model_dump(),
188
188
  )
189
189
  build_model = Client().zen_store.create_build(build=build_request)
190
190
 
@@ -38,7 +38,7 @@ from typing import (
38
38
  from uuid import UUID
39
39
 
40
40
  import yaml
41
- from pydantic import ValidationError
41
+ from pydantic import ConfigDict, ValidationError
42
42
 
43
43
  from zenml import constants
44
44
  from zenml.analytics.enums import AnalyticsEvent
@@ -378,7 +378,7 @@ class Pipeline:
378
378
  to_be_reapplied = []
379
379
  for param_, value_ in values.items():
380
380
  if (
381
- param_ in PipelineRunConfiguration.__fields__
381
+ param_ in PipelineRunConfiguration.model_fields
382
382
  and param_ in self._from_config_file
383
383
  and value_ != self._from_config_file[param_]
384
384
  ):
@@ -389,16 +389,17 @@ class Pipeline:
389
389
  msg = ""
390
390
  reapply_during_run_warning = (
391
391
  "The value of parameter '{name}' has changed from "
392
- "'{file_value}' to '{new_value}' set in your configuration file.\n"
392
+ "'{file_value}' to '{new_value}' set in your configuration "
393
+ "file.\n"
393
394
  )
394
395
  for name, file_value, new_value in to_be_reapplied:
395
396
  msg += reapply_during_run_warning.format(
396
397
  name=name, file_value=file_value, new_value=new_value
397
398
  )
398
399
  msg += (
399
- "Configuration file value will be used during pipeline run, "
400
- "so you change will not be efficient. Consider updating your "
401
- "configuration file instead."
400
+ "Configuration file value will be used during pipeline "
401
+ "run, so you change will not be efficient. Consider "
402
+ "updating your configuration file instead."
402
403
  )
403
404
  logger.warning(msg)
404
405
 
@@ -501,7 +502,9 @@ To avoid this consider setting pipeline parameters only in one place (config or
501
502
  self._prepare_if_possible()
502
503
  integration_registry.activate_integrations()
503
504
 
504
- if self.configuration.dict(exclude_defaults=True, exclude={"name"}):
505
+ if self.configuration.model_dump(
506
+ exclude_defaults=True, exclude={"name"}
507
+ ):
505
508
  logger.warning(
506
509
  f"The pipeline `{self.name}` that you're registering has "
507
510
  "custom configurations applied to it. These will not be "
@@ -729,7 +732,7 @@ To avoid this consider setting pipeline parameters only in one place (config or
729
732
  build=build_id,
730
733
  schedule=schedule_id,
731
734
  code_reference=code_reference,
732
- **deployment.dict(),
735
+ **deployment.model_dump(),
733
736
  )
734
737
  deployment_model = Client().zen_store.create_deployment(
735
738
  deployment=deployment_request
@@ -1006,13 +1009,13 @@ To avoid this consider setting pipeline parameters only in one place (config or
1006
1009
 
1007
1010
  self._parse_config_file(
1008
1011
  config_path=config_path,
1009
- matcher=list(PipelineRunConfiguration.__fields__.keys()),
1012
+ matcher=list(PipelineRunConfiguration.model_fields.keys()),
1010
1013
  )
1011
1014
 
1012
1015
  run_config = PipelineRunConfiguration(**self._from_config_file)
1013
1016
 
1014
1017
  new_values = dict_utils.remove_none_values(run_configuration_args)
1015
- update = PipelineRunConfiguration.parse_obj(new_values)
1018
+ update = PipelineRunConfiguration.model_validate(new_values)
1016
1019
 
1017
1020
  # Update with the values in code so they take precedence
1018
1021
  run_config = pydantic_utils.update_model(run_config, update=update)
@@ -1291,7 +1294,7 @@ To avoid this consider setting pipeline parameters only in one place (config or
1291
1294
  else:
1292
1295
  from zenml.model.model import Model
1293
1296
 
1294
- _from_config_file["model"] = Model.parse_obj(
1297
+ _from_config_file["model"] = Model.model_validate(
1295
1298
  _from_config_file["model"]
1296
1299
  )
1297
1300
  self._from_config_file = _from_config_file
@@ -1410,14 +1413,15 @@ To avoid this consider setting pipeline parameters only in one place (config or
1410
1413
  try:
1411
1414
  validated_args = pydantic_utils.validate_function_args(
1412
1415
  self.entrypoint,
1413
- {"arbitrary_types_allowed": False, "smart_union": True},
1416
+ ConfigDict(arbitrary_types_allowed=False),
1414
1417
  *args,
1415
1418
  **kwargs,
1416
1419
  )
1417
1420
  except ValidationError as e:
1418
1421
  raise ValueError(
1419
- "Invalid or missing inputs for pipeline entrypoint function. "
1422
+ "Invalid or missing pipeline function entrypoint arguments. "
1420
1423
  "Only JSON serializable inputs are allowed as pipeline inputs."
1424
+ "Check out the pydantic error above for more details."
1421
1425
  ) from e
1422
1426
 
1423
1427
  self._parameters = validated_args
@@ -1,5 +1,6 @@
1
1
  """Utility functions for running pipelines."""
2
2
 
3
+ import time
3
4
  from collections import defaultdict
4
5
  from datetime import datetime
5
6
  from types import FunctionType
@@ -16,19 +17,23 @@ from uuid import UUID
16
17
 
17
18
  from zenml import constants
18
19
  from zenml.client import Client
20
+ from zenml.config.pipeline_run_configuration import PipelineRunConfiguration
19
21
  from zenml.config.step_configurations import StepConfigurationUpdate
20
22
  from zenml.enums import ExecutionStatus, ModelStages
21
23
  from zenml.logger import get_logger
22
24
  from zenml.models import (
25
+ FlavorFilter,
23
26
  PipelineDeploymentBase,
24
27
  PipelineDeploymentResponse,
25
28
  PipelineRunRequest,
26
29
  PipelineRunResponse,
30
+ StackResponse,
27
31
  )
28
32
  from zenml.new.pipelines.model_utils import NewModelRequest
29
33
  from zenml.orchestrators.utils import get_run_name
30
- from zenml.stack import Stack
34
+ from zenml.stack import Flavor, Stack
31
35
  from zenml.utils import cloud_utils
36
+ from zenml.zen_stores.base_zen_store import BaseZenStore
32
37
 
33
38
  if TYPE_CHECKING:
34
39
  from zenml.config.source import Source
@@ -258,3 +263,100 @@ def _validate_new_version_requests(
258
263
  "Models can be viewed in the dashboard using ZenML Pro. Sign up "
259
264
  "for a free trial at https://www.zenml.io/cloud/"
260
265
  )
266
+
267
+
268
+ def wait_for_pipeline_run_to_finish(run_id: UUID) -> "PipelineRunResponse":
269
+ """Waits until a pipeline run is finished.
270
+
271
+ Args:
272
+ run_id: ID of the run for which to wait.
273
+
274
+ Returns:
275
+ Model of the finished run.
276
+ """
277
+ sleep_interval = 1
278
+ max_sleep_interval = 64
279
+
280
+ while True:
281
+ run = Client().get_pipeline_run(run_id)
282
+
283
+ if run.status.is_finished:
284
+ return run
285
+
286
+ logger.info(
287
+ "Waiting for pipeline run with ID %s to finish (current status: %s)",
288
+ run_id,
289
+ run.status,
290
+ )
291
+ time.sleep(sleep_interval)
292
+ if sleep_interval < max_sleep_interval:
293
+ sleep_interval *= 2
294
+
295
+
296
+ def validate_stack_is_runnable_from_server(
297
+ zen_store: BaseZenStore, stack: StackResponse
298
+ ) -> None:
299
+ """Validate if a stack model is runnable from the server.
300
+
301
+ Args:
302
+ zen_store: ZenStore to use for listing flavors.
303
+ stack: The stack to validate.
304
+
305
+ Raises:
306
+ ValueError: If the stack has components of a custom flavor or local
307
+ components.
308
+ """
309
+ for component_list in stack.components.values():
310
+ assert len(component_list) == 1
311
+ component = component_list[0]
312
+ flavors = zen_store.list_flavors(
313
+ FlavorFilter(name=component.flavor, type=component.type)
314
+ )
315
+ assert len(flavors) == 1
316
+ flavor_model = flavors[0]
317
+
318
+ if flavor_model.workspace is not None:
319
+ raise ValueError("No custom stack component flavors allowed.")
320
+
321
+ flavor = Flavor.from_model(flavor_model)
322
+ component_config = flavor.config_class(**component.configuration)
323
+
324
+ if component_config.is_local:
325
+ raise ValueError("No local stack components allowed.")
326
+
327
+
328
+ def validate_run_config_is_runnable_from_server(
329
+ run_configuration: "PipelineRunConfiguration",
330
+ ) -> None:
331
+ """Validates that the run configuration can be used to run from the server.
332
+
333
+ Args:
334
+ run_configuration: The run configuration to validate.
335
+
336
+ Raises:
337
+ ValueError: If there are values in the run configuration that are not
338
+ allowed when running a pipeline from the server.
339
+ """
340
+ if run_configuration.parameters:
341
+ raise ValueError(
342
+ "Can't set parameters when running pipeline via Rest API."
343
+ )
344
+
345
+ if run_configuration.build:
346
+ raise ValueError("Can't set build when running pipeline via Rest API.")
347
+
348
+ if run_configuration.schedule:
349
+ raise ValueError(
350
+ "Can't set schedule when running pipeline via Rest API."
351
+ )
352
+
353
+ if run_configuration.settings.get("docker"):
354
+ raise ValueError(
355
+ "Can't set DockerSettings when running pipeline via Rest API."
356
+ )
357
+
358
+ for step_update in run_configuration.steps.values():
359
+ if step_update.settings.get("docker"):
360
+ raise ValueError(
361
+ "Can't set DockerSettings when running pipeline via Rest API."
362
+ )
@@ -16,13 +16,14 @@
16
16
  from abc import ABC, abstractmethod
17
17
  from typing import TYPE_CHECKING, Any, Dict, Optional, Type, cast
18
18
 
19
- from pydantic import root_validator
19
+ from pydantic import model_validator
20
20
 
21
21
  from zenml.enums import StackComponentType
22
22
  from zenml.logger import get_logger
23
23
  from zenml.orchestrators.step_launcher import StepLauncher
24
24
  from zenml.orchestrators.utils import get_config_environment_vars
25
25
  from zenml.stack import Flavor, Stack, StackComponent, StackComponentConfig
26
+ from zenml.utils.pydantic_utils import before_validator_handler
26
27
 
27
28
  if TYPE_CHECKING:
28
29
  from zenml.config.step_configurations import Step
@@ -34,18 +35,20 @@ logger = get_logger(__name__)
34
35
  class BaseOrchestratorConfig(StackComponentConfig):
35
36
  """Base orchestrator config."""
36
37
 
37
- @root_validator(pre=True)
38
- def _deprecations(cls, values: Dict[str, Any]) -> Dict[str, Any]:
38
+ @model_validator(mode="before")
39
+ @classmethod
40
+ @before_validator_handler
41
+ def _deprecations(cls, data: Dict[str, Any]) -> Dict[str, Any]:
39
42
  """Validate and/or remove deprecated fields.
40
43
 
41
44
  Args:
42
- values: The values to validate.
45
+ data: The values to validate.
43
46
 
44
47
  Returns:
45
48
  The validated values.
46
49
  """
47
- if "custom_docker_base_image_name" in values:
48
- image_name = values.pop("custom_docker_base_image_name", None)
50
+ if "custom_docker_base_image_name" in data:
51
+ image_name = data.pop("custom_docker_base_image_name", None)
49
52
  if image_name:
50
53
  logger.warning(
51
54
  "The 'custom_docker_base_image_name' field has been "
@@ -54,7 +57,7 @@ class BaseOrchestratorConfig(StackComponentConfig):
54
57
  "pipeline (see https://docs.zenml.io/how-to/customize-docker-builds)."
55
58
  )
56
59
 
57
- return values
60
+ return data
58
61
 
59
62
  @property
60
63
  def is_synchronous(self) -> bool:
@@ -206,7 +206,7 @@ class LocalDockerOrchestratorSettings(BaseSettings):
206
206
  run_args: Dict[str, Any] = {}
207
207
 
208
208
 
209
- class LocalDockerOrchestratorConfig( # type: ignore[misc] # https://github.com/pydantic/pydantic/issues/4173
209
+ class LocalDockerOrchestratorConfig(
210
210
  BaseOrchestratorConfig, LocalDockerOrchestratorSettings
211
211
  ):
212
212
  """Local Docker orchestrator config."""