zenml-nightly 0.58.2.dev20240615__py3-none-any.whl → 0.58.2.dev20240623__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 (313) 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 +1 -1
  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 +1 -5
  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/pipeline_docker_image_builder.py +9 -0
  225. zenml/utils/pydantic_utils.py +270 -62
  226. zenml/utils/secret_utils.py +65 -12
  227. zenml/utils/source_utils.py +2 -2
  228. zenml/utils/typed_model.py +5 -3
  229. zenml/utils/typing_utils.py +243 -0
  230. zenml/utils/yaml_utils.py +1 -1
  231. zenml/zen_server/auth.py +2 -2
  232. zenml/zen_server/cloud_utils.py +6 -6
  233. zenml/zen_server/deploy/base_provider.py +1 -1
  234. zenml/zen_server/deploy/deployment.py +6 -8
  235. zenml/zen_server/deploy/docker/docker_zen_server.py +3 -4
  236. zenml/zen_server/deploy/local/local_provider.py +0 -1
  237. zenml/zen_server/deploy/local/local_zen_server.py +6 -6
  238. zenml/zen_server/deploy/terraform/terraform_zen_server.py +4 -6
  239. zenml/zen_server/exceptions.py +4 -1
  240. zenml/zen_server/feature_gate/zenml_cloud_feature_gate.py +1 -1
  241. zenml/zen_server/pipeline_deployment/utils.py +48 -68
  242. zenml/zen_server/rbac/models.py +2 -5
  243. zenml/zen_server/rbac/utils.py +11 -14
  244. zenml/zen_server/routers/auth_endpoints.py +2 -2
  245. zenml/zen_server/routers/pipeline_builds_endpoints.py +1 -1
  246. zenml/zen_server/routers/runs_endpoints.py +1 -1
  247. zenml/zen_server/routers/secrets_endpoints.py +3 -2
  248. zenml/zen_server/routers/server_endpoints.py +1 -1
  249. zenml/zen_server/routers/steps_endpoints.py +1 -1
  250. zenml/zen_server/routers/workspaces_endpoints.py +1 -1
  251. zenml/zen_stores/base_zen_store.py +46 -9
  252. zenml/zen_stores/migrations/utils.py +42 -46
  253. zenml/zen_stores/migrations/versions/0701da9951a0_added_service_table.py +1 -1
  254. zenml/zen_stores/migrations/versions/1041bc644e0d_remove_secrets_manager.py +5 -3
  255. zenml/zen_stores/migrations/versions/10a907dad202_delete_mlmd_tables.py +1 -1
  256. zenml/zen_stores/migrations/versions/26b776ad583e_redesign_artifacts.py +8 -10
  257. zenml/zen_stores/migrations/versions/37835ce041d2_optimizing_database.py +3 -3
  258. zenml/zen_stores/migrations/versions/46506f72f0ed_add_server_settings.py +10 -12
  259. zenml/zen_stores/migrations/versions/5994f9ad0489_introduce_role_permissions.py +3 -2
  260. zenml/zen_stores/migrations/versions/6917bce75069_add_pipeline_run_unique_constraint.py +4 -4
  261. zenml/zen_stores/migrations/versions/728c6369cfaa_add_name_column_to_input_artifact_pk.py +3 -2
  262. zenml/zen_stores/migrations/versions/743ec82b1b3c_update_size_of_build_images.py +2 -2
  263. zenml/zen_stores/migrations/versions/7500f434b71c_remove_shared_columns.py +3 -2
  264. zenml/zen_stores/migrations/versions/7834208cc3f6_artifact_project_scoping.py +8 -7
  265. zenml/zen_stores/migrations/versions/7b651bf6822e_track_secrets_in_db.py +6 -4
  266. zenml/zen_stores/migrations/versions/7e4a481d17f7_add_identity_table.py +2 -2
  267. zenml/zen_stores/migrations/versions/7f603e583dd7_fixed_migration.py +1 -1
  268. zenml/zen_stores/migrations/versions/a39c4184c8ce_remove_secrets_manager_flavors.py +2 -2
  269. zenml/zen_stores/migrations/versions/a91762e6be36_artifact_version_table.py +4 -4
  270. zenml/zen_stores/migrations/versions/alembic_start.py +1 -1
  271. zenml/zen_stores/migrations/versions/fbd7f18ced1e_increase_step_run_field_lengths.py +4 -4
  272. zenml/zen_stores/rest_zen_store.py +109 -49
  273. zenml/zen_stores/schemas/api_key_schemas.py +1 -1
  274. zenml/zen_stores/schemas/artifact_schemas.py +8 -8
  275. zenml/zen_stores/schemas/artifact_visualization_schemas.py +3 -3
  276. zenml/zen_stores/schemas/code_repository_schemas.py +1 -1
  277. zenml/zen_stores/schemas/component_schemas.py +8 -3
  278. zenml/zen_stores/schemas/device_schemas.py +8 -6
  279. zenml/zen_stores/schemas/event_source_schemas.py +3 -4
  280. zenml/zen_stores/schemas/flavor_schemas.py +5 -3
  281. zenml/zen_stores/schemas/model_schemas.py +26 -1
  282. zenml/zen_stores/schemas/pipeline_build_schemas.py +1 -1
  283. zenml/zen_stores/schemas/pipeline_deployment_schemas.py +4 -4
  284. zenml/zen_stores/schemas/pipeline_run_schemas.py +6 -6
  285. zenml/zen_stores/schemas/pipeline_schemas.py +5 -2
  286. zenml/zen_stores/schemas/run_metadata_schemas.py +2 -2
  287. zenml/zen_stores/schemas/secret_schemas.py +8 -5
  288. zenml/zen_stores/schemas/server_settings_schemas.py +3 -1
  289. zenml/zen_stores/schemas/service_connector_schemas.py +1 -1
  290. zenml/zen_stores/schemas/service_schemas.py +11 -2
  291. zenml/zen_stores/schemas/stack_schemas.py +1 -1
  292. zenml/zen_stores/schemas/step_run_schemas.py +11 -11
  293. zenml/zen_stores/schemas/tag_schemas.py +6 -2
  294. zenml/zen_stores/schemas/trigger_schemas.py +2 -2
  295. zenml/zen_stores/schemas/user_schemas.py +2 -2
  296. zenml/zen_stores/schemas/workspace_schemas.py +3 -1
  297. zenml/zen_stores/secrets_stores/aws_secrets_store.py +19 -20
  298. zenml/zen_stores/secrets_stores/azure_secrets_store.py +17 -20
  299. zenml/zen_stores/secrets_stores/base_secrets_store.py +79 -12
  300. zenml/zen_stores/secrets_stores/gcp_secrets_store.py +17 -20
  301. zenml/zen_stores/secrets_stores/hashicorp_secrets_store.py +4 -8
  302. zenml/zen_stores/secrets_stores/service_connector_secrets_store.py +10 -7
  303. zenml/zen_stores/secrets_stores/sql_secrets_store.py +5 -6
  304. zenml/zen_stores/sql_zen_store.py +196 -120
  305. zenml/zen_stores/zen_store_interface.py +33 -0
  306. {zenml_nightly-0.58.2.dev20240615.dist-info → zenml_nightly-0.58.2.dev20240623.dist-info}/METADATA +9 -7
  307. {zenml_nightly-0.58.2.dev20240615.dist-info → zenml_nightly-0.58.2.dev20240623.dist-info}/RECORD +310 -307
  308. zenml/integrations/kubeflow/utils.py +0 -95
  309. zenml/models/v2/base/internal.py +0 -37
  310. zenml/models/v2/base/update.py +0 -44
  311. {zenml_nightly-0.58.2.dev20240615.dist-info → zenml_nightly-0.58.2.dev20240623.dist-info}/LICENSE +0 -0
  312. {zenml_nightly-0.58.2.dev20240615.dist-info → zenml_nightly-0.58.2.dev20240623.dist-info}/WHEEL +0 -0
  313. {zenml_nightly-0.58.2.dev20240615.dist-info → zenml_nightly-0.58.2.dev20240623.dist-info}/entry_points.txt +0 -0
@@ -14,13 +14,14 @@
14
14
  """Models representing schedules."""
15
15
 
16
16
  import datetime
17
- from typing import Any, Dict, Optional, Union
17
+ from typing import Optional, Union
18
18
  from uuid import UUID
19
19
 
20
- from pydantic import Field, root_validator
20
+ from pydantic import Field, model_validator
21
21
 
22
22
  from zenml.constants import STR_FIELD_MAX_LENGTH
23
23
  from zenml.logger import get_logger
24
+ from zenml.models.v2.base.base import BaseUpdate
24
25
  from zenml.models.v2.base.scoped import (
25
26
  WorkspaceScopedFilter,
26
27
  WorkspaceScopedRequest,
@@ -29,7 +30,6 @@ from zenml.models.v2.base.scoped import (
29
30
  WorkspaceScopedResponseMetadata,
30
31
  WorkspaceScopedResponseResources,
31
32
  )
32
- from zenml.models.v2.base.update import update_model
33
33
 
34
34
  logger = get_logger(__name__)
35
35
 
@@ -53,15 +53,12 @@ class ScheduleRequest(WorkspaceScopedRequest):
53
53
  orchestrator_id: Optional[UUID]
54
54
  pipeline_id: Optional[UUID]
55
55
 
56
- @root_validator
56
+ @model_validator(mode="after")
57
57
  def _ensure_cron_or_periodic_schedule_configured(
58
- cls, values: Dict[str, Any]
59
- ) -> Dict[str, Any]:
58
+ self,
59
+ ) -> "ScheduleRequest":
60
60
  """Ensures that the cron expression or start time + interval are set.
61
61
 
62
- Args:
63
- values: All attributes of the schedule.
64
-
65
62
  Returns:
66
63
  All schedule attributes.
67
64
 
@@ -69,11 +66,9 @@ class ScheduleRequest(WorkspaceScopedRequest):
69
66
  ValueError: If no cron expression or start time + interval were
70
67
  provided.
71
68
  """
72
- cron_expression = values.get("cron_expression")
73
- periodic_schedule = values.get("start_time") and values.get(
74
- "interval_second"
75
- )
76
- run_once_starts_at = values.get("run_once_start_time")
69
+ cron_expression = self.cron_expression
70
+ periodic_schedule = self.start_time and self.interval_second
71
+ run_once_starts_at = self.run_once_start_time
77
72
 
78
73
  if cron_expression and periodic_schedule:
79
74
  logger.warning(
@@ -83,7 +78,7 @@ class ScheduleRequest(WorkspaceScopedRequest):
83
78
  "but will usually ignore the interval and use the cron "
84
79
  "expression."
85
80
  )
86
- return values
81
+ return self
87
82
  elif cron_expression and run_once_starts_at:
88
83
  logger.warning(
89
84
  "This schedule was created with a cron expression as well as "
@@ -91,9 +86,9 @@ class ScheduleRequest(WorkspaceScopedRequest):
91
86
  "depends on the concrete orchestrator implementation but will "
92
87
  "usually ignore the `run_once_start_time`."
93
88
  )
94
- return values
89
+ return self
95
90
  elif cron_expression or periodic_schedule or run_once_starts_at:
96
- return values
91
+ return self
97
92
  else:
98
93
  raise ValueError(
99
94
  "Either a cron expression, a start time and interval seconds "
@@ -105,10 +100,20 @@ class ScheduleRequest(WorkspaceScopedRequest):
105
100
  # ------------------ Update Model ------------------
106
101
 
107
102
 
108
- @update_model
109
- class ScheduleUpdate(ScheduleRequest):
103
+ class ScheduleUpdate(BaseUpdate):
110
104
  """Update model for schedules."""
111
105
 
106
+ name: Optional[str] = None
107
+ active: Optional[bool] = None
108
+ cron_expression: Optional[str] = None
109
+ start_time: Optional[datetime.datetime] = None
110
+ end_time: Optional[datetime.datetime] = None
111
+ interval_second: Optional[datetime.timedelta] = None
112
+ catchup: Optional[bool] = None
113
+ run_once_start_time: Optional[datetime.datetime] = None
114
+ orchestrator_id: Optional[UUID] = None
115
+ pipeline_id: Optional[UUID] = None
116
+
112
117
 
113
118
  # ------------------ Response Model ------------------
114
119
 
@@ -275,17 +280,24 @@ class ScheduleFilter(WorkspaceScopedFilter):
275
280
  """Model to enable advanced filtering of all Users."""
276
281
 
277
282
  workspace_id: Optional[Union[UUID, str]] = Field(
278
- default=None, description="Workspace scope of the schedule."
283
+ default=None,
284
+ description="Workspace scope of the schedule.",
285
+ union_mode="left_to_right",
279
286
  )
280
287
  user_id: Optional[Union[UUID, str]] = Field(
281
- default=None, description="User that created the schedule"
288
+ default=None,
289
+ description="User that created the schedule",
290
+ union_mode="left_to_right",
282
291
  )
283
292
  pipeline_id: Optional[Union[UUID, str]] = Field(
284
- default=None, description="Pipeline that the schedule is attached to."
293
+ default=None,
294
+ description="Pipeline that the schedule is attached to.",
295
+ union_mode="left_to_right",
285
296
  )
286
297
  orchestrator_id: Optional[Union[UUID, str]] = Field(
287
298
  default=None,
288
299
  description="Orchestrator that the schedule is attached to.",
300
+ union_mode="left_to_right",
289
301
  )
290
302
  active: Optional[bool] = Field(
291
303
  default=None,
@@ -296,10 +308,10 @@ class ScheduleFilter(WorkspaceScopedFilter):
296
308
  description="The cron expression, describing the schedule",
297
309
  )
298
310
  start_time: Optional[Union[datetime.datetime, str]] = Field(
299
- default=None, description="Start time"
311
+ default=None, description="Start time", union_mode="left_to_right"
300
312
  )
301
313
  end_time: Optional[Union[datetime.datetime, str]] = Field(
302
- default=None, description="End time"
314
+ default=None, description="End time", union_mode="left_to_right"
303
315
  )
304
316
  interval_second: Optional[Optional[float]] = Field(
305
317
  default=None,
@@ -317,4 +329,5 @@ class ScheduleFilter(WorkspaceScopedFilter):
317
329
  run_once_start_time: Optional[Union[datetime.datetime, str]] = Field(
318
330
  default=None,
319
331
  description="The time at which the schedule should run once",
332
+ union_mode="left_to_right",
320
333
  )
@@ -26,6 +26,7 @@ from zenml.enums import (
26
26
  SecretScope,
27
27
  SorterOps,
28
28
  )
29
+ from zenml.models.v2.base.base import BaseUpdate
29
30
  from zenml.models.v2.base.scoped import (
30
31
  WorkspaceScopedFilter,
31
32
  WorkspaceScopedRequest,
@@ -34,7 +35,7 @@ from zenml.models.v2.base.scoped import (
34
35
  WorkspaceScopedResponseMetadata,
35
36
  WorkspaceScopedResponseResources,
36
37
  )
37
- from zenml.models.v2.base.update import update_model
38
+ from zenml.utils.secret_utils import PlainSerializedSecretStr
38
39
 
39
40
  # ------------------ Request Model ------------------
40
41
 
@@ -51,7 +52,7 @@ class SecretRequest(WorkspaceScopedRequest):
51
52
  scope: SecretScope = Field(
52
53
  SecretScope.WORKSPACE, title="The scope of the secret."
53
54
  )
54
- values: Dict[str, Optional[SecretStr]] = Field(
55
+ values: Dict[str, Optional[PlainSerializedSecretStr]] = Field(
55
56
  default_factory=dict, title="The values stored in this secret."
56
57
  )
57
58
 
@@ -77,13 +78,23 @@ class SecretRequest(WorkspaceScopedRequest):
77
78
  # ------------------ Update Model ------------------
78
79
 
79
80
 
80
- @update_model
81
- class SecretUpdate(SecretRequest):
81
+ class SecretUpdate(BaseUpdate):
82
82
  """Secret update model."""
83
83
 
84
- scope: Optional[SecretScope] = Field( # type: ignore[assignment]
84
+ ANALYTICS_FIELDS: ClassVar[List[str]] = ["scope"]
85
+
86
+ name: Optional[str] = Field(
87
+ title="The name of the secret.",
88
+ max_length=STR_FIELD_MAX_LENGTH,
89
+ default=None,
90
+ )
91
+ scope: Optional[SecretScope] = Field(
85
92
  default=None, title="The scope of the secret."
86
93
  )
94
+ values: Optional[Dict[str, Optional[PlainSerializedSecretStr]]] = Field(
95
+ title="The values stored in this secret.",
96
+ default=None,
97
+ )
87
98
 
88
99
  def get_secret_values_update(self) -> Dict[str, Optional[str]]:
89
100
  """Returns a dictionary with the secret values to update.
@@ -91,10 +102,13 @@ class SecretUpdate(SecretRequest):
91
102
  Returns:
92
103
  A dictionary with the secret values to update.
93
104
  """
94
- return {
95
- k: v.get_secret_value() if v is not None else None
96
- for k, v in self.values.items()
97
- }
105
+ if self.values is not None:
106
+ return {
107
+ k: v.get_secret_value() if v is not None else None
108
+ for k, v in self.values.items()
109
+ }
110
+
111
+ return {}
98
112
 
99
113
 
100
114
  # ------------------ Response Model ------------------
@@ -106,7 +120,7 @@ class SecretResponseBody(WorkspaceScopedResponseBody):
106
120
  scope: SecretScope = Field(
107
121
  SecretScope.WORKSPACE, title="The scope of the secret."
108
122
  )
109
- values: Dict[str, Optional[SecretStr]] = Field(
123
+ values: Dict[str, Optional[PlainSerializedSecretStr]] = Field(
110
124
  default_factory=dict, title="The values stored in this secret."
111
125
  )
112
126
 
@@ -243,14 +257,19 @@ class SecretFilter(WorkspaceScopedFilter):
243
257
  scope: Optional[Union[SecretScope, str]] = Field(
244
258
  default=None,
245
259
  description="Scope in which to filter secrets",
260
+ union_mode="left_to_right",
246
261
  )
247
262
 
248
263
  workspace_id: Optional[Union[UUID, str]] = Field(
249
- default=None, description="Workspace of the Secret"
264
+ default=None,
265
+ description="Workspace of the Secret",
266
+ union_mode="left_to_right",
250
267
  )
251
268
 
252
269
  user_id: Optional[Union[UUID, str]] = Field(
253
- default=None, description="User that created the Secret"
270
+ default=None,
271
+ description="User that created the Secret",
272
+ union_mode="left_to_right",
254
273
  )
255
274
 
256
275
  @staticmethod
@@ -15,7 +15,6 @@
15
15
 
16
16
  from datetime import datetime
17
17
  from typing import (
18
- TYPE_CHECKING,
19
18
  Any,
20
19
  ClassVar,
21
20
  Dict,
@@ -26,8 +25,8 @@ from typing import (
26
25
  )
27
26
  from uuid import UUID
28
27
 
29
- from pydantic import BaseModel, Field
30
- from sqlalchemy.sql.elements import BinaryExpression, BooleanClauseList
28
+ from pydantic import BaseModel, ConfigDict, Field
29
+ from sqlalchemy.sql.elements import ColumnElement
31
30
  from sqlmodel import SQLModel
32
31
 
33
32
  from zenml.constants import STR_FIELD_MAX_LENGTH
@@ -43,9 +42,6 @@ from zenml.models.v2.base.scoped import (
43
42
  from zenml.services.service_status import ServiceState
44
43
  from zenml.services.service_type import ServiceType
45
44
 
46
- if TYPE_CHECKING:
47
- pass
48
-
49
45
  # ------------------ Request Model ------------------
50
46
 
51
47
 
@@ -56,50 +52,46 @@ class ServiceRequest(WorkspaceScopedRequest):
56
52
  title="The name of the service.",
57
53
  max_length=STR_FIELD_MAX_LENGTH,
58
54
  )
59
-
60
55
  service_type: ServiceType = Field(
61
56
  title="The type of the service.",
62
57
  )
63
-
64
58
  service_source: Optional[str] = Field(
65
59
  title="The class of the service.",
66
- description="The fully qualified class name of the service implementation.",
60
+ description="The fully qualified class name of the service "
61
+ "implementation.",
62
+ default=None,
67
63
  )
68
-
69
64
  admin_state: Optional[ServiceState] = Field(
70
65
  title="The admin state of the service.",
71
- description="The administrative state of the service, e.g., ACTIVE, INACTIVE.",
66
+ description="The administrative state of the service, e.g., ACTIVE, "
67
+ "INACTIVE.",
68
+ default=None,
72
69
  )
73
-
74
70
  config: Dict[str, Any] = Field(
75
71
  title="The service config.",
76
- description="A dictionary containing configuration parameters for the service.",
72
+ description="A dictionary containing configuration parameters for the "
73
+ "service.",
77
74
  )
78
-
79
75
  labels: Optional[Dict[str, str]] = Field(
80
76
  default=None,
81
77
  title="The service labels.",
82
78
  )
83
-
84
79
  status: Optional[Dict[str, Any]] = Field(
80
+ default=None,
85
81
  title="The status of the service.",
86
82
  )
87
-
88
83
  endpoint: Optional[Dict[str, Any]] = Field(
89
84
  default=None,
90
85
  title="The service endpoint.",
91
86
  )
92
-
93
87
  prediction_url: Optional[str] = Field(
94
88
  default=None,
95
89
  title="The service endpoint URL.",
96
90
  )
97
-
98
91
  health_check_url: Optional[str] = Field(
99
92
  default=None,
100
93
  title="The service health check URL.",
101
94
  )
102
-
103
95
  model_version_id: Optional[UUID] = Field(
104
96
  default=None,
105
97
  title="The model version id linked to the service.",
@@ -107,8 +99,17 @@ class ServiceRequest(WorkspaceScopedRequest):
107
99
  pipeline_run_id: Optional[Union[UUID, str]] = Field(
108
100
  default=None,
109
101
  description="By the event source this trigger is attached to.",
102
+ union_mode="left_to_right",
110
103
  )
111
104
 
105
+ # TODO: In Pydantic v2, the `model_` is a protected namespaces for all
106
+ # fields defined under base models. If not handled, this raises a warning.
107
+ # It is possible to suppress this warning message with the following
108
+ # configuration, however the ultimate solution is to rename these fields.
109
+ # Even though they do not cause any problems right now, if we are not
110
+ # careful we might overwrite some fields protected by pydantic.
111
+ model_config = ConfigDict(protected_namespaces=())
112
+
112
113
 
113
114
  # ------------------ Update Model ------------------
114
115
 
@@ -117,46 +118,55 @@ class ServiceUpdate(BaseModel):
117
118
  """Update model for stack components."""
118
119
 
119
120
  name: Optional[str] = Field(
121
+ None,
120
122
  title="The name of the service.",
121
123
  max_length=STR_FIELD_MAX_LENGTH,
122
124
  )
123
-
124
125
  admin_state: Optional[ServiceState] = Field(
126
+ None,
125
127
  title="The admin state of the service.",
126
- description="The administrative state of the service, e.g., ACTIVE, INACTIVE.",
128
+ description="The administrative state of the service, e.g., ACTIVE, "
129
+ "INACTIVE.",
127
130
  )
128
-
129
131
  service_source: Optional[str] = Field(
132
+ None,
130
133
  title="The class of the service.",
131
- description="The fully qualified class name of the service implementation.",
134
+ description="The fully qualified class name of the service "
135
+ "implementation.",
132
136
  )
133
-
134
137
  status: Optional[Dict[str, Any]] = Field(
138
+ None,
135
139
  title="The status of the service.",
136
140
  )
137
-
138
141
  endpoint: Optional[Dict[str, Any]] = Field(
142
+ None,
139
143
  title="The service endpoint.",
140
144
  )
141
-
142
145
  prediction_url: Optional[str] = Field(
146
+ None,
143
147
  title="The service endpoint URL.",
144
148
  )
145
-
146
149
  health_check_url: Optional[str] = Field(
150
+ None,
147
151
  title="The service health check URL.",
148
152
  )
149
-
150
153
  labels: Optional[Dict[str, str]] = Field(
151
154
  default=None,
152
155
  title="The service labels.",
153
156
  )
154
-
155
157
  model_version_id: Optional[UUID] = Field(
156
158
  default=None,
157
159
  title="The model version id linked to the service.",
158
160
  )
159
161
 
162
+ # TODO: In Pydantic v2, the `model_` is a protected namespaces for all
163
+ # fields defined under base models. If not handled, this raises a warning.
164
+ # It is possible to suppress this warning message with the following
165
+ # configuration, however the ultimate solution is to rename these fields.
166
+ # Even though they do not cause any problems right now, if we are not
167
+ # careful we might overwrite some fields protected by pydantic.
168
+ model_config = ConfigDict(protected_namespaces=())
169
+
160
170
 
161
171
  # ------------------ Response Model ------------------
162
172
 
@@ -362,13 +372,19 @@ class ServiceFilter(WorkspaceScopedFilter):
362
372
  """
363
373
 
364
374
  name: Optional[str] = Field(
365
- description="Name of the service. Use this to filter services by their name.",
375
+ default=None,
376
+ description="Name of the service. Use this to filter services by "
377
+ "their name.",
366
378
  )
367
379
  workspace_id: Optional[Union[UUID, str]] = Field(
368
- default=None, description="Workspace of the service"
380
+ default=None,
381
+ description="Workspace of the service",
382
+ union_mode="left_to_right",
369
383
  )
370
384
  user_id: Optional[Union[UUID, str]] = Field(
371
- default=None, description="User of the service"
385
+ default=None,
386
+ description="User of the service",
387
+ union_mode="left_to_right",
372
388
  )
373
389
  type: Optional[str] = Field(
374
390
  default=None,
@@ -376,11 +392,13 @@ class ServiceFilter(WorkspaceScopedFilter):
376
392
  )
377
393
  flavor: Optional[str] = Field(
378
394
  default=None,
379
- description="Flavor of the service. Use this to filter services by their flavor.",
395
+ description="Flavor of the service. Use this to filter services by "
396
+ "their flavor.",
380
397
  )
381
398
  config: Optional[bytes] = Field(
382
399
  default=None,
383
- description="Config of the service. Use this to filter services by their config.",
400
+ description="Config of the service. Use this to filter services by "
401
+ "their config.",
384
402
  )
385
403
  pipeline_name: Optional[str] = Field(
386
404
  default=None,
@@ -396,12 +414,22 @@ class ServiceFilter(WorkspaceScopedFilter):
396
414
  model_version_id: Optional[Union[UUID, str]] = Field(
397
415
  default=None,
398
416
  description="By the model version this service is attached to.",
417
+ union_mode="left_to_right",
399
418
  )
400
419
  pipeline_run_id: Optional[Union[UUID, str]] = Field(
401
420
  default=None,
402
421
  description="By the pipeline run this service is attached to.",
422
+ union_mode="left_to_right",
403
423
  )
404
424
 
425
+ # TODO: In Pydantic v2, the `model_` is a protected namespaces for all
426
+ # fields defined under base models. If not handled, this raises a warning.
427
+ # It is possible to suppress this warning message with the following
428
+ # configuration, however the ultimate solution is to rename these fields.
429
+ # Even though they do not cause any problems right now, if we are not
430
+ # careful we might overwrite some fields protected by pydantic.
431
+ model_config = ConfigDict(protected_namespaces=())
432
+
405
433
  def set_type(self, type: str) -> None:
406
434
  """Set the type of the service.
407
435
 
@@ -441,7 +469,7 @@ class ServiceFilter(WorkspaceScopedFilter):
441
469
 
442
470
  def generate_filter(
443
471
  self, table: Type["SQLModel"]
444
- ) -> Union["BinaryExpression[Any]", "BooleanClauseList[Any]"]:
472
+ ) -> Union["ColumnElement[bool]"]:
445
473
  """Generate the filter for the query.
446
474
 
447
475
  Services can be scoped by type to narrow the search.
@@ -452,7 +480,7 @@ class ServiceFilter(WorkspaceScopedFilter):
452
480
  Returns:
453
481
  The filter expression for the query.
454
482
  """
455
- from sqlalchemy import and_
483
+ from sqlmodel import and_
456
484
 
457
485
  base_filter = super().generate_filter(table)
458
486
 
@@ -15,7 +15,7 @@
15
15
 
16
16
  from typing import TYPE_CHECKING, ClassVar, List, Optional, Type, Union
17
17
 
18
- from pydantic import Field
18
+ from pydantic import ConfigDict, Field
19
19
 
20
20
  from zenml.constants import STR_FIELD_MAX_LENGTH, TEXT_FIELD_MAX_LENGTH
21
21
  from zenml.models.v2.base.base import (
@@ -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 AnyQuery, BaseFilter
29
- from zenml.models.v2.base.update import update_model
30
30
 
31
31
  if TYPE_CHECKING:
32
32
  from zenml.models.v2.base.filter import AnySchema
@@ -52,22 +52,34 @@ class ServiceAccountRequest(BaseRequest):
52
52
  max_length=TEXT_FIELD_MAX_LENGTH,
53
53
  )
54
54
  active: bool = Field(title="Whether the service account is active or not.")
55
-
56
- class Config:
57
- """Pydantic configuration class."""
58
-
59
- # Validate attributes when assigning them
60
- validate_assignment = True
61
- extra = "ignore"
55
+ model_config = ConfigDict(validate_assignment=True, extra="ignore")
62
56
 
63
57
 
64
58
  # ------------------ Update Model ------------------
65
59
 
66
60
 
67
- @update_model
68
- class ServiceAccountUpdate(ServiceAccountRequest):
61
+ class ServiceAccountUpdate(BaseUpdate):
69
62
  """Update model for service accounts."""
70
63
 
64
+ ANALYTICS_FIELDS: ClassVar[List[str]] = ["name", "active"]
65
+
66
+ name: Optional[str] = Field(
67
+ title="The unique name for the service account.",
68
+ max_length=STR_FIELD_MAX_LENGTH,
69
+ default=None,
70
+ )
71
+ description: Optional[str] = Field(
72
+ title="A description of the service account.",
73
+ max_length=TEXT_FIELD_MAX_LENGTH,
74
+ default=None,
75
+ )
76
+ active: Optional[bool] = Field(
77
+ title="Whether the service account is active or not.",
78
+ default=None,
79
+ )
80
+
81
+ model_config = ConfigDict(validate_assignment=True)
82
+
71
83
 
72
84
  # ------------------ Response Model ------------------
73
85
 
@@ -189,6 +201,7 @@ class ServiceAccountFilter(BaseFilter):
189
201
  active: Optional[Union[bool, str]] = Field(
190
202
  default=None,
191
203
  description="Whether the user is active",
204
+ union_mode="left_to_right",
192
205
  )
193
206
 
194
207
  def apply_filter(