zenml-nightly 0.58.2.dev20240618__py3-none-any.whl → 0.58.2.dev20240620__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 (300) 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/store_config.py +20 -19
  35. zenml/config/strict_base_model.py +2 -6
  36. zenml/constants.py +26 -2
  37. zenml/container_registries/base_container_registry.py +3 -2
  38. zenml/container_registries/default_container_registry.py +3 -3
  39. zenml/event_hub/base_event_hub.py +1 -1
  40. zenml/event_sources/base_event_source.py +11 -16
  41. zenml/exceptions.py +4 -0
  42. zenml/integrations/airflow/__init__.py +2 -10
  43. zenml/integrations/airflow/flavors/airflow_orchestrator_flavor.py +6 -7
  44. zenml/integrations/airflow/orchestrators/airflow_orchestrator.py +13 -249
  45. zenml/integrations/airflow/orchestrators/dag_generator.py +5 -3
  46. zenml/integrations/argilla/flavors/argilla_annotator_flavor.py +5 -4
  47. zenml/integrations/aws/__init__.py +1 -1
  48. zenml/integrations/aws/flavors/aws_container_registry_flavor.py +3 -2
  49. zenml/integrations/aws/flavors/sagemaker_orchestrator_flavor.py +11 -5
  50. zenml/integrations/aws/flavors/sagemaker_step_operator_flavor.py +6 -2
  51. zenml/integrations/aws/service_connectors/aws_service_connector.py +5 -4
  52. zenml/integrations/azure/flavors/azureml_step_operator_flavor.py +4 -4
  53. zenml/integrations/azure/service_connectors/azure_service_connector.py +4 -3
  54. zenml/integrations/azure/step_operators/azureml_step_operator.py +1 -1
  55. zenml/integrations/bentoml/steps/bentoml_deployer.py +1 -1
  56. zenml/integrations/bitbucket/plugins/event_sources/bitbucket_webhook_event_source.py +8 -12
  57. zenml/integrations/comet/flavors/comet_experiment_tracker_flavor.py +1 -1
  58. zenml/integrations/evidently/__init__.py +3 -4
  59. zenml/integrations/evidently/column_mapping.py +11 -3
  60. zenml/integrations/evidently/data_validators/evidently_data_validator.py +21 -3
  61. zenml/integrations/evidently/metrics.py +5 -6
  62. zenml/integrations/evidently/tests.py +5 -6
  63. zenml/integrations/facets/models.py +2 -6
  64. zenml/integrations/feast/__init__.py +3 -1
  65. zenml/integrations/feast/feature_stores/feast_feature_store.py +0 -23
  66. zenml/integrations/gcp/__init__.py +1 -1
  67. zenml/integrations/gcp/flavors/vertex_orchestrator_flavor.py +1 -1
  68. zenml/integrations/gcp/flavors/vertex_step_operator_flavor.py +1 -1
  69. zenml/integrations/gcp/orchestrators/vertex_orchestrator.py +234 -103
  70. zenml/integrations/gcp/service_connectors/gcp_service_connector.py +57 -42
  71. zenml/integrations/github/code_repositories/github_code_repository.py +1 -1
  72. zenml/integrations/github/plugins/event_sources/github_webhook_event_source.py +9 -13
  73. zenml/integrations/great_expectations/__init__.py +1 -1
  74. zenml/integrations/great_expectations/data_validators/ge_data_validator.py +44 -44
  75. zenml/integrations/great_expectations/flavors/great_expectations_data_validator_flavor.py +35 -2
  76. zenml/integrations/great_expectations/ge_store_backend.py +24 -11
  77. zenml/integrations/great_expectations/materializers/ge_materializer.py +3 -3
  78. zenml/integrations/great_expectations/utils.py +5 -5
  79. zenml/integrations/huggingface/__init__.py +3 -0
  80. zenml/integrations/huggingface/flavors/huggingface_model_deployer_flavor.py +1 -1
  81. zenml/integrations/huggingface/steps/__init__.py +3 -0
  82. zenml/integrations/huggingface/steps/accelerate_runner.py +149 -0
  83. zenml/integrations/huggingface/steps/huggingface_deployer.py +2 -2
  84. zenml/integrations/hyperai/flavors/hyperai_orchestrator_flavor.py +1 -1
  85. zenml/integrations/hyperai/service_connectors/hyperai_service_connector.py +4 -3
  86. zenml/integrations/kubeflow/__init__.py +1 -1
  87. zenml/integrations/kubeflow/flavors/kubeflow_orchestrator_flavor.py +48 -81
  88. zenml/integrations/kubeflow/orchestrators/kubeflow_orchestrator.py +295 -245
  89. zenml/integrations/kubernetes/flavors/kubernetes_orchestrator_flavor.py +1 -1
  90. zenml/integrations/kubernetes/orchestrators/kubernetes_orchestrator_entrypoint.py +11 -2
  91. zenml/integrations/kubernetes/pod_settings.py +17 -31
  92. zenml/integrations/kubernetes/service_connectors/kubernetes_service_connector.py +8 -7
  93. zenml/integrations/label_studio/__init__.py +1 -3
  94. zenml/integrations/label_studio/annotators/label_studio_annotator.py +3 -4
  95. zenml/integrations/label_studio/flavors/label_studio_annotator_flavor.py +2 -2
  96. zenml/integrations/langchain/materializers/document_materializer.py +44 -8
  97. zenml/integrations/mlflow/__init__.py +9 -3
  98. zenml/integrations/mlflow/experiment_trackers/mlflow_experiment_tracker.py +1 -1
  99. zenml/integrations/mlflow/flavors/mlflow_experiment_tracker_flavor.py +29 -37
  100. zenml/integrations/mlflow/model_registries/mlflow_model_registry.py +4 -4
  101. zenml/integrations/mlflow/steps/mlflow_deployer.py +1 -1
  102. zenml/integrations/neptune/flavors/neptune_experiment_tracker_flavor.py +1 -1
  103. zenml/integrations/pigeon/flavors/pigeon_annotator_flavor.py +1 -1
  104. zenml/integrations/s3/flavors/s3_artifact_store_flavor.py +9 -8
  105. zenml/integrations/seldon/seldon_client.py +52 -67
  106. zenml/integrations/seldon/services/seldon_deployment.py +3 -3
  107. zenml/integrations/seldon/steps/seldon_deployer.py +4 -4
  108. zenml/integrations/skypilot/flavors/skypilot_orchestrator_base_vm_config.py +15 -5
  109. zenml/integrations/skypilot_aws/__init__.py +1 -1
  110. zenml/integrations/skypilot_aws/flavors/skypilot_orchestrator_aws_vm_flavor.py +1 -1
  111. zenml/integrations/skypilot_azure/__init__.py +1 -1
  112. zenml/integrations/skypilot_azure/flavors/skypilot_orchestrator_azure_vm_flavor.py +1 -1
  113. zenml/integrations/skypilot_gcp/__init__.py +2 -1
  114. zenml/integrations/skypilot_gcp/flavors/skypilot_orchestrator_gcp_vm_flavor.py +1 -1
  115. zenml/integrations/skypilot_lambda/flavors/skypilot_orchestrator_lambda_vm_flavor.py +2 -2
  116. zenml/integrations/spark/flavors/spark_step_operator_flavor.py +1 -1
  117. zenml/integrations/tekton/__init__.py +1 -1
  118. zenml/integrations/tekton/flavors/tekton_orchestrator_flavor.py +66 -23
  119. zenml/integrations/tekton/orchestrators/tekton_orchestrator.py +547 -233
  120. zenml/integrations/tensorboard/__init__.py +1 -12
  121. zenml/integrations/tensorboard/services/tensorboard_service.py +3 -5
  122. zenml/integrations/tensorboard/visualizers/tensorboard_visualizer.py +6 -6
  123. zenml/integrations/tensorflow/__init__.py +2 -10
  124. zenml/integrations/tensorflow/materializers/keras_materializer.py +17 -9
  125. zenml/integrations/wandb/flavors/wandb_experiment_tracker_flavor.py +9 -14
  126. zenml/integrations/whylogs/flavors/whylogs_data_validator_flavor.py +1 -1
  127. zenml/lineage_graph/lineage_graph.py +1 -1
  128. zenml/materializers/built_in_materializer.py +3 -3
  129. zenml/materializers/pydantic_materializer.py +2 -2
  130. zenml/metadata/lazy_load.py +4 -4
  131. zenml/metadata/metadata_types.py +64 -4
  132. zenml/model/model.py +79 -54
  133. zenml/model_deployers/base_model_deployer.py +14 -12
  134. zenml/model_registries/base_model_registry.py +17 -15
  135. zenml/models/__init__.py +79 -206
  136. zenml/models/v2/base/base.py +54 -41
  137. zenml/models/v2/base/base_plugin_flavor.py +2 -6
  138. zenml/models/v2/base/filter.py +91 -76
  139. zenml/models/v2/base/page.py +2 -12
  140. zenml/models/v2/base/scoped.py +4 -7
  141. zenml/models/v2/core/api_key.py +22 -8
  142. zenml/models/v2/core/artifact.py +2 -2
  143. zenml/models/v2/core/artifact_version.py +74 -40
  144. zenml/models/v2/core/code_repository.py +37 -10
  145. zenml/models/v2/core/component.py +65 -16
  146. zenml/models/v2/core/device.py +14 -4
  147. zenml/models/v2/core/event_source.py +1 -2
  148. zenml/models/v2/core/flavor.py +74 -8
  149. zenml/models/v2/core/logs.py +68 -8
  150. zenml/models/v2/core/model.py +8 -4
  151. zenml/models/v2/core/model_version.py +25 -6
  152. zenml/models/v2/core/model_version_artifact.py +51 -21
  153. zenml/models/v2/core/model_version_pipeline_run.py +45 -13
  154. zenml/models/v2/core/pipeline.py +37 -72
  155. zenml/models/v2/core/pipeline_build.py +29 -17
  156. zenml/models/v2/core/pipeline_deployment.py +18 -6
  157. zenml/models/v2/core/pipeline_namespace.py +113 -0
  158. zenml/models/v2/core/pipeline_run.py +50 -22
  159. zenml/models/v2/core/run_metadata.py +59 -36
  160. zenml/models/v2/core/schedule.py +37 -24
  161. zenml/models/v2/core/secret.py +31 -12
  162. zenml/models/v2/core/service.py +64 -36
  163. zenml/models/v2/core/service_account.py +24 -11
  164. zenml/models/v2/core/service_connector.py +219 -44
  165. zenml/models/v2/core/stack.py +45 -17
  166. zenml/models/v2/core/step_run.py +28 -8
  167. zenml/models/v2/core/tag.py +8 -4
  168. zenml/models/v2/core/trigger.py +2 -2
  169. zenml/models/v2/core/trigger_execution.py +1 -0
  170. zenml/models/v2/core/user.py +18 -21
  171. zenml/models/v2/core/workspace.py +13 -3
  172. zenml/models/v2/misc/build_item.py +3 -3
  173. zenml/models/v2/misc/external_user.py +2 -6
  174. zenml/models/v2/misc/hub_plugin_models.py +9 -9
  175. zenml/models/v2/misc/loaded_visualization.py +2 -2
  176. zenml/models/v2/misc/service_connector_type.py +8 -17
  177. zenml/models/v2/misc/user_auth.py +7 -2
  178. zenml/new/pipelines/build_utils.py +3 -3
  179. zenml/new/pipelines/pipeline.py +17 -13
  180. zenml/new/pipelines/run_utils.py +103 -1
  181. zenml/orchestrators/base_orchestrator.py +10 -7
  182. zenml/orchestrators/local_docker/local_docker_orchestrator.py +1 -1
  183. zenml/orchestrators/step_runner.py +3 -6
  184. zenml/orchestrators/utils.py +1 -1
  185. zenml/plugins/base_plugin_flavor.py +6 -10
  186. zenml/plugins/plugin_flavor_registry.py +3 -7
  187. zenml/secret/base_secret.py +7 -8
  188. zenml/service_connectors/docker_service_connector.py +4 -3
  189. zenml/service_connectors/service_connector.py +5 -12
  190. zenml/service_connectors/service_connector_registry.py +2 -4
  191. zenml/services/container/container_service.py +1 -1
  192. zenml/services/container/container_service_endpoint.py +1 -1
  193. zenml/services/local/local_service.py +1 -1
  194. zenml/services/local/local_service_endpoint.py +1 -1
  195. zenml/services/service.py +16 -10
  196. zenml/services/service_type.py +4 -5
  197. zenml/services/terraform/terraform_service.py +1 -1
  198. zenml/stack/flavor.py +1 -5
  199. zenml/stack/flavor_registry.py +4 -4
  200. zenml/stack/stack.py +4 -1
  201. zenml/stack/stack_component.py +55 -31
  202. zenml/steps/base_step.py +34 -28
  203. zenml/steps/entrypoint_function_utils.py +3 -5
  204. zenml/steps/utils.py +12 -14
  205. zenml/utils/cuda_utils.py +50 -0
  206. zenml/utils/deprecation_utils.py +18 -20
  207. zenml/utils/dict_utils.py +1 -1
  208. zenml/utils/filesync_model.py +65 -28
  209. zenml/utils/function_utils.py +260 -0
  210. zenml/utils/json_utils.py +131 -0
  211. zenml/utils/mlstacks_utils.py +2 -2
  212. zenml/utils/pydantic_utils.py +270 -62
  213. zenml/utils/secret_utils.py +65 -12
  214. zenml/utils/source_utils.py +2 -2
  215. zenml/utils/typed_model.py +5 -3
  216. zenml/utils/typing_utils.py +243 -0
  217. zenml/utils/yaml_utils.py +1 -1
  218. zenml/zen_server/auth.py +2 -2
  219. zenml/zen_server/cloud_utils.py +6 -6
  220. zenml/zen_server/deploy/base_provider.py +1 -1
  221. zenml/zen_server/deploy/deployment.py +6 -8
  222. zenml/zen_server/deploy/docker/docker_zen_server.py +3 -4
  223. zenml/zen_server/deploy/local/local_provider.py +0 -1
  224. zenml/zen_server/deploy/local/local_zen_server.py +6 -6
  225. zenml/zen_server/deploy/terraform/terraform_zen_server.py +4 -6
  226. zenml/zen_server/exceptions.py +4 -1
  227. zenml/zen_server/feature_gate/zenml_cloud_feature_gate.py +1 -1
  228. zenml/zen_server/pipeline_deployment/utils.py +48 -68
  229. zenml/zen_server/rbac/models.py +2 -5
  230. zenml/zen_server/rbac/utils.py +11 -14
  231. zenml/zen_server/routers/auth_endpoints.py +2 -2
  232. zenml/zen_server/routers/pipeline_builds_endpoints.py +1 -1
  233. zenml/zen_server/routers/runs_endpoints.py +1 -1
  234. zenml/zen_server/routers/secrets_endpoints.py +3 -2
  235. zenml/zen_server/routers/server_endpoints.py +1 -1
  236. zenml/zen_server/routers/steps_endpoints.py +1 -1
  237. zenml/zen_server/routers/workspaces_endpoints.py +1 -1
  238. zenml/zen_stores/base_zen_store.py +46 -9
  239. zenml/zen_stores/migrations/utils.py +42 -46
  240. zenml/zen_stores/migrations/versions/0701da9951a0_added_service_table.py +1 -1
  241. zenml/zen_stores/migrations/versions/1041bc644e0d_remove_secrets_manager.py +5 -3
  242. zenml/zen_stores/migrations/versions/10a907dad202_delete_mlmd_tables.py +1 -1
  243. zenml/zen_stores/migrations/versions/26b776ad583e_redesign_artifacts.py +8 -10
  244. zenml/zen_stores/migrations/versions/37835ce041d2_optimizing_database.py +3 -3
  245. zenml/zen_stores/migrations/versions/46506f72f0ed_add_server_settings.py +10 -12
  246. zenml/zen_stores/migrations/versions/5994f9ad0489_introduce_role_permissions.py +3 -2
  247. zenml/zen_stores/migrations/versions/6917bce75069_add_pipeline_run_unique_constraint.py +4 -4
  248. zenml/zen_stores/migrations/versions/728c6369cfaa_add_name_column_to_input_artifact_pk.py +3 -2
  249. zenml/zen_stores/migrations/versions/743ec82b1b3c_update_size_of_build_images.py +2 -2
  250. zenml/zen_stores/migrations/versions/7500f434b71c_remove_shared_columns.py +3 -2
  251. zenml/zen_stores/migrations/versions/7834208cc3f6_artifact_project_scoping.py +8 -7
  252. zenml/zen_stores/migrations/versions/7b651bf6822e_track_secrets_in_db.py +6 -4
  253. zenml/zen_stores/migrations/versions/7e4a481d17f7_add_identity_table.py +2 -2
  254. zenml/zen_stores/migrations/versions/7f603e583dd7_fixed_migration.py +1 -1
  255. zenml/zen_stores/migrations/versions/a39c4184c8ce_remove_secrets_manager_flavors.py +2 -2
  256. zenml/zen_stores/migrations/versions/a91762e6be36_artifact_version_table.py +4 -4
  257. zenml/zen_stores/migrations/versions/alembic_start.py +1 -1
  258. zenml/zen_stores/migrations/versions/fbd7f18ced1e_increase_step_run_field_lengths.py +4 -4
  259. zenml/zen_stores/rest_zen_store.py +109 -49
  260. zenml/zen_stores/schemas/api_key_schemas.py +1 -1
  261. zenml/zen_stores/schemas/artifact_schemas.py +8 -8
  262. zenml/zen_stores/schemas/artifact_visualization_schemas.py +3 -3
  263. zenml/zen_stores/schemas/code_repository_schemas.py +1 -1
  264. zenml/zen_stores/schemas/component_schemas.py +8 -3
  265. zenml/zen_stores/schemas/device_schemas.py +8 -6
  266. zenml/zen_stores/schemas/event_source_schemas.py +3 -4
  267. zenml/zen_stores/schemas/flavor_schemas.py +5 -3
  268. zenml/zen_stores/schemas/model_schemas.py +26 -1
  269. zenml/zen_stores/schemas/pipeline_build_schemas.py +1 -1
  270. zenml/zen_stores/schemas/pipeline_deployment_schemas.py +4 -4
  271. zenml/zen_stores/schemas/pipeline_run_schemas.py +6 -6
  272. zenml/zen_stores/schemas/pipeline_schemas.py +5 -2
  273. zenml/zen_stores/schemas/run_metadata_schemas.py +2 -2
  274. zenml/zen_stores/schemas/secret_schemas.py +8 -5
  275. zenml/zen_stores/schemas/server_settings_schemas.py +3 -1
  276. zenml/zen_stores/schemas/service_connector_schemas.py +1 -1
  277. zenml/zen_stores/schemas/service_schemas.py +11 -2
  278. zenml/zen_stores/schemas/stack_schemas.py +1 -1
  279. zenml/zen_stores/schemas/step_run_schemas.py +11 -11
  280. zenml/zen_stores/schemas/tag_schemas.py +6 -2
  281. zenml/zen_stores/schemas/trigger_schemas.py +2 -2
  282. zenml/zen_stores/schemas/user_schemas.py +2 -2
  283. zenml/zen_stores/schemas/workspace_schemas.py +3 -1
  284. zenml/zen_stores/secrets_stores/aws_secrets_store.py +19 -20
  285. zenml/zen_stores/secrets_stores/azure_secrets_store.py +17 -20
  286. zenml/zen_stores/secrets_stores/base_secrets_store.py +79 -12
  287. zenml/zen_stores/secrets_stores/gcp_secrets_store.py +17 -20
  288. zenml/zen_stores/secrets_stores/hashicorp_secrets_store.py +4 -8
  289. zenml/zen_stores/secrets_stores/service_connector_secrets_store.py +10 -7
  290. zenml/zen_stores/secrets_stores/sql_secrets_store.py +5 -6
  291. zenml/zen_stores/sql_zen_store.py +196 -120
  292. zenml/zen_stores/zen_store_interface.py +33 -0
  293. {zenml_nightly-0.58.2.dev20240618.dist-info → zenml_nightly-0.58.2.dev20240620.dist-info}/METADATA +8 -7
  294. {zenml_nightly-0.58.2.dev20240618.dist-info → zenml_nightly-0.58.2.dev20240620.dist-info}/RECORD +297 -294
  295. zenml/integrations/kubeflow/utils.py +0 -95
  296. zenml/models/v2/base/internal.py +0 -37
  297. zenml/models/v2/base/update.py +0 -44
  298. {zenml_nightly-0.58.2.dev20240618.dist-info → zenml_nightly-0.58.2.dev20240620.dist-info}/LICENSE +0 -0
  299. {zenml_nightly-0.58.2.dev20240618.dist-info → zenml_nightly-0.58.2.dev20240620.dist-info}/WHEEL +0 -0
  300. {zenml_nightly-0.58.2.dev20240618.dist-info → zenml_nightly-0.58.2.dev20240620.dist-info}/entry_points.txt +0 -0
@@ -19,7 +19,7 @@ from secrets import token_hex
19
19
  from typing import Any, Dict, List, Optional, Union
20
20
  from uuid import UUID
21
21
 
22
- from pydantic import BaseModel, Field, SecretStr, root_validator
22
+ from pydantic import BaseModel, ConfigDict, Field, model_validator
23
23
 
24
24
  from zenml.constants import (
25
25
  DEFAULT_ZENML_JWT_TOKEN_ALGORITHM,
@@ -46,6 +46,7 @@ from zenml.constants import (
46
46
  from zenml.enums import AuthScheme
47
47
  from zenml.logger import get_logger
48
48
  from zenml.models import ServerDeploymentType
49
+ from zenml.utils.pydantic_utils import before_validator_handler
49
50
 
50
51
  logger = get_logger(__name__)
51
52
 
@@ -270,30 +271,41 @@ class ServerConfiguration(BaseModel):
270
271
  login_rate_limit_minute: int = DEFAULT_ZENML_SERVER_LOGIN_RATE_LIMIT_MINUTE
271
272
  login_rate_limit_day: int = DEFAULT_ZENML_SERVER_LOGIN_RATE_LIMIT_DAY
272
273
 
273
- secure_headers_server: Union[bool, str] = True
274
- secure_headers_hsts: Union[bool, str] = (
275
- DEFAULT_ZENML_SERVER_SECURE_HEADERS_HSTS
274
+ secure_headers_server: Union[bool, str] = Field(
275
+ default=True,
276
+ union_mode="left_to_right",
276
277
  )
277
- secure_headers_xfo: Union[bool, str] = (
278
- DEFAULT_ZENML_SERVER_SECURE_HEADERS_XFO
278
+ secure_headers_hsts: Union[bool, str] = Field(
279
+ default=DEFAULT_ZENML_SERVER_SECURE_HEADERS_HSTS,
280
+ union_mode="left_to_right",
279
281
  )
280
- secure_headers_xxp: Union[bool, str] = (
281
- DEFAULT_ZENML_SERVER_SECURE_HEADERS_XXP
282
+ secure_headers_xfo: Union[bool, str] = Field(
283
+ default=DEFAULT_ZENML_SERVER_SECURE_HEADERS_XFO,
284
+ union_mode="left_to_right",
282
285
  )
283
- secure_headers_content: Union[bool, str] = (
284
- DEFAULT_ZENML_SERVER_SECURE_HEADERS_CONTENT
286
+ secure_headers_xxp: Union[bool, str] = Field(
287
+ default=DEFAULT_ZENML_SERVER_SECURE_HEADERS_XXP,
288
+ union_mode="left_to_right",
285
289
  )
286
- secure_headers_csp: Union[bool, str] = (
287
- DEFAULT_ZENML_SERVER_SECURE_HEADERS_CSP
290
+ secure_headers_content: Union[bool, str] = Field(
291
+ default=DEFAULT_ZENML_SERVER_SECURE_HEADERS_CONTENT,
292
+ union_mode="left_to_right",
288
293
  )
289
- secure_headers_referrer: Union[bool, str] = (
290
- DEFAULT_ZENML_SERVER_SECURE_HEADERS_REFERRER
294
+ secure_headers_csp: Union[bool, str] = Field(
295
+ default=DEFAULT_ZENML_SERVER_SECURE_HEADERS_CSP,
296
+ union_mode="left_to_right",
291
297
  )
292
- secure_headers_cache: Union[bool, str] = (
293
- DEFAULT_ZENML_SERVER_SECURE_HEADERS_CACHE
298
+ secure_headers_referrer: Union[bool, str] = Field(
299
+ default=DEFAULT_ZENML_SERVER_SECURE_HEADERS_REFERRER,
300
+ union_mode="left_to_right",
294
301
  )
295
- secure_headers_permissions: Union[bool, str] = (
296
- DEFAULT_ZENML_SERVER_SECURE_HEADERS_PERMISSIONS
302
+ secure_headers_cache: Union[bool, str] = Field(
303
+ default=DEFAULT_ZENML_SERVER_SECURE_HEADERS_CACHE,
304
+ union_mode="left_to_right",
305
+ )
306
+ secure_headers_permissions: Union[bool, str] = Field(
307
+ default=DEFAULT_ZENML_SERVER_SECURE_HEADERS_PERMISSIONS,
308
+ union_mode="left_to_right",
297
309
  )
298
310
  use_legacy_dashboard: bool = DEFAULT_ZENML_SERVER_USE_LEGACY_DASHBOARD
299
311
 
@@ -306,12 +318,14 @@ class ServerConfiguration(BaseModel):
306
318
 
307
319
  _deployment_id: Optional[UUID] = None
308
320
 
309
- @root_validator(pre=True)
310
- def _validate_config(cls, values: Dict[str, Any]) -> Dict[str, Any]:
321
+ @model_validator(mode="before")
322
+ @classmethod
323
+ @before_validator_handler
324
+ def _validate_config(cls, data: Dict[str, Any]) -> Dict[str, Any]:
311
325
  """Validate the server configuration.
312
326
 
313
327
  Args:
314
- values: The server configuration values.
328
+ data: The server configuration values.
315
329
 
316
330
  Returns:
317
331
  The validated server configuration values.
@@ -319,10 +333,10 @@ class ServerConfiguration(BaseModel):
319
333
  Raises:
320
334
  ValueError: If the server configuration is invalid.
321
335
  """
322
- if values.get("auth_scheme") == AuthScheme.EXTERNAL:
336
+ if data.get("auth_scheme") == AuthScheme.EXTERNAL:
323
337
  # If the authentication scheme is set to `EXTERNAL`, the
324
338
  # external authenticator URLs must be specified.
325
- if not values.get("external_login_url") or not values.get(
339
+ if not data.get("external_login_url") or not data.get(
326
340
  "external_user_info_url"
327
341
  ):
328
342
  raise ValueError(
@@ -333,22 +347,22 @@ class ServerConfiguration(BaseModel):
333
347
 
334
348
  # If the authentication scheme is set to `EXTERNAL`, the
335
349
  # external cookie name must be specified.
336
- if not values.get("external_cookie_name"):
350
+ if not data.get("external_cookie_name"):
337
351
  raise ValueError(
338
352
  "The external cookie name must be specified when "
339
353
  "using the EXTERNAL authentication scheme."
340
354
  )
341
355
 
342
- if cors_allow_origins := values.get("cors_allow_origins"):
356
+ if cors_allow_origins := data.get("cors_allow_origins"):
343
357
  origins = cors_allow_origins.split(",")
344
- values["cors_allow_origins"] = origins
358
+ data["cors_allow_origins"] = origins
345
359
  else:
346
- values["cors_allow_origins"] = ["*"]
360
+ data["cors_allow_origins"] = ["*"]
347
361
 
348
362
  # if metadata is a string, convert it to a dictionary
349
- if isinstance(values.get("metadata"), str):
363
+ if isinstance(data.get("metadata"), str):
350
364
  try:
351
- values["metadata"] = json.loads(values["metadata"])
365
+ data["metadata"] = json.loads(data["metadata"])
352
366
  except json.JSONDecodeError as e:
353
367
  raise ValueError(
354
368
  f"The server metadata is not a valid JSON string: {e}"
@@ -356,15 +370,15 @@ class ServerConfiguration(BaseModel):
356
370
 
357
371
  # if one of the secure headers options is set to a boolean value, set
358
372
  # the corresponding value
359
- for k, v in values.copy().items():
373
+ for k, v in data.copy().items():
360
374
  if k.startswith("secure_headers_") and isinstance(v, str):
361
375
  if v.lower() in ["disabled", "no", "none", "false", "off", ""]:
362
- values[k] = False
376
+ data[k] = False
363
377
  if v.lower() in ["enabled", "yes", "true", "on"]:
364
378
  # Revert to the default value if the header is enabled
365
- del values[k]
379
+ del data[k]
366
380
 
367
- return values
381
+ return data
368
382
 
369
383
  @property
370
384
  def deployment_id(self) -> UUID:
@@ -490,18 +504,8 @@ class ServerConfiguration(BaseModel):
490
504
 
491
505
  return ServerConfiguration(**env_server_config)
492
506
 
493
- class Config:
494
- """Pydantic configuration class."""
495
-
507
+ model_config = ConfigDict(
496
508
  # Allow extra attributes from configs of previous ZenML versions to
497
509
  # permit downgrading
498
- extra = "allow"
499
- # all attributes with leading underscore are private and therefore
500
- # are mutable and not included in serialization
501
- underscore_attrs_are_private = True
502
-
503
- # This is needed to allow correct handling of SecretStr values during
504
- # serialization.
505
- json_encoders = {
506
- SecretStr: lambda v: v.get_secret_value() if v else None
507
- }
510
+ extra="allow",
511
+ )
@@ -122,7 +122,7 @@ class SettingsResolver:
122
122
  Returns:
123
123
  The converted settings.
124
124
  """
125
- settings_dict = self._settings.dict()
125
+ settings_dict = dict(self._settings)
126
126
  try:
127
127
  return target_class(**settings_dict)
128
128
  except ValidationError:
zenml/config/source.py CHANGED
@@ -14,10 +14,17 @@
14
14
  """Source classes."""
15
15
 
16
16
  from enum import Enum
17
- from typing import TYPE_CHECKING, Any, Optional, Type, Union
17
+ from typing import TYPE_CHECKING, Any, Dict, Optional
18
18
  from uuid import UUID
19
19
 
20
- from pydantic import BaseModel, Extra, validator
20
+ from pydantic import (
21
+ BaseModel,
22
+ BeforeValidator,
23
+ ConfigDict,
24
+ SerializeAsAny,
25
+ field_validator,
26
+ )
27
+ from typing_extensions import Annotated
21
28
 
22
29
  from zenml.logger import get_logger
23
30
 
@@ -130,10 +137,29 @@ class Source(BaseModel):
130
137
  """
131
138
  return self.attribute is None
132
139
 
133
- class Config:
134
- """Pydantic config class."""
140
+ model_config = ConfigDict(extra="allow")
135
141
 
136
- extra = Extra.allow
142
+ def model_dump(self, **kwargs: Any) -> Dict[str, Any]:
143
+ """Dump the source as a dictionary.
144
+
145
+ Args:
146
+ **kwargs: Additional keyword arguments.
147
+
148
+ Returns:
149
+ The source as a dictionary.
150
+ """
151
+ return super().model_dump(serialize_as_any=True, **kwargs)
152
+
153
+ def model_dump_json(self, **kwargs: Any) -> str:
154
+ """Dump the source as a JSON string.
155
+
156
+ Args:
157
+ **kwargs: Additional keyword arguments.
158
+
159
+ Returns:
160
+ The source as a JSON string.
161
+ """
162
+ return super().model_dump_json(serialize_as_any=True, **kwargs)
137
163
 
138
164
 
139
165
  class DistributionPackageSource(Source):
@@ -148,7 +174,8 @@ class DistributionPackageSource(Source):
148
174
  version: Optional[str] = None
149
175
  type: SourceType = SourceType.DISTRIBUTION_PACKAGE
150
176
 
151
- @validator("type")
177
+ @field_validator("type")
178
+ @classmethod
152
179
  def _validate_type(cls, value: SourceType) -> SourceType:
153
180
  """Validate the source type.
154
181
 
@@ -182,7 +209,8 @@ class CodeRepositorySource(Source):
182
209
  subdirectory: str
183
210
  type: SourceType = SourceType.CODE_REPOSITORY
184
211
 
185
- @validator("type")
212
+ @field_validator("type")
213
+ @classmethod
186
214
  def _validate_type(cls, value: SourceType) -> SourceType:
187
215
  """Validate the source type.
188
216
 
@@ -201,39 +229,21 @@ class CodeRepositorySource(Source):
201
229
  return value
202
230
 
203
231
 
204
- def convert_source_validator(*attributes: str) -> "AnyClassMethod":
205
- """Function to convert pydantic fields containing legacy class paths.
206
-
207
- In older versions, sources (sometimes also called class paths) like
208
- `zenml.materializers.BuiltInMaterializer` were stored as strings in our
209
- configuration classes. These strings got replaced by a separate class, and
210
- this function returns a validator to convert those old strings to the new
211
- classes.
232
+ def convert_source(source: Any) -> Any:
233
+ """Converts an old source string to a source object.
212
234
 
213
235
  Args:
214
- *attributes: List of attributes to convert.
236
+ source: Source string or object.
215
237
 
216
238
  Returns:
217
- Pydantic validator class method to be used on BaseModel subclasses
218
- to convert source fields.
239
+ The converted source.
219
240
  """
241
+ if isinstance(source, str):
242
+ source = Source.from_import_path(source)
220
243
 
221
- @validator(*attributes, pre=True, allow_reuse=True)
222
- def _convert_source(
223
- cls: Type[BaseModel], value: Union[Source, str, None]
224
- ) -> Optional[Source]:
225
- """Converts an old source string to a source object.
226
-
227
- Args:
228
- cls: The class on which the attributes are defined.
229
- value: Source string or object.
244
+ return source
230
245
 
231
- Returns:
232
- The converted source.
233
- """
234
- if isinstance(value, str):
235
- value = Source.from_import_path(value)
236
-
237
- return value
238
246
 
239
- return _convert_source
247
+ SourceWithValidator = Annotated[
248
+ SerializeAsAny[Source], BeforeValidator(convert_source)
249
+ ]
@@ -24,7 +24,12 @@ from typing import (
24
24
  Union,
25
25
  )
26
26
 
27
- from pydantic import root_validator, validator
27
+ from pydantic import (
28
+ ConfigDict,
29
+ SerializeAsAny,
30
+ field_validator,
31
+ model_validator,
32
+ )
28
33
 
29
34
  from zenml.artifacts.external_artifact_config import (
30
35
  ExternalArtifactConfiguration,
@@ -33,12 +38,13 @@ from zenml.client_lazy_loader import ClientLazyLoader
33
38
  from zenml.config.base_settings import BaseSettings, SettingsOrDict
34
39
  from zenml.config.constants import DOCKER_SETTINGS_KEY, RESOURCE_SETTINGS_KEY
35
40
  from zenml.config.retry_config import StepRetryConfig
36
- from zenml.config.source import Source, convert_source_validator
41
+ from zenml.config.source import Source, SourceWithValidator
37
42
  from zenml.config.strict_base_model import StrictBaseModel
38
43
  from zenml.logger import get_logger
39
44
  from zenml.model.lazy_load import ModelVersionDataLazyLoader
40
45
  from zenml.model.model import Model
41
46
  from zenml.utils import deprecation_utils
47
+ from zenml.utils.pydantic_utils import before_validator_handler
42
48
 
43
49
  if TYPE_CHECKING:
44
50
  from zenml.config import DockerSettings, ResourceSettings
@@ -54,25 +60,30 @@ class PartialArtifactConfiguration(StrictBaseModel):
54
60
  # for all steps/outputs
55
61
  default_materializer_source: Optional[Source] = None
56
62
 
57
- @root_validator(pre=True)
63
+ @model_validator(mode="before")
64
+ @classmethod
65
+ @before_validator_handler
58
66
  def _remove_deprecated_attributes(
59
- cls, values: Dict[str, Any]
67
+ cls, data: Dict[str, Any]
60
68
  ) -> Dict[str, Any]:
61
69
  """Removes deprecated attributes from the values dict.
62
70
 
63
71
  Args:
64
- values: The values dict used to instantiate the model.
72
+ data: The values dict used to instantiate the model.
65
73
 
66
74
  Returns:
67
75
  The values dict without deprecated attributes.
68
76
  """
69
77
  deprecated_attributes = ["artifact_source"]
78
+
70
79
  for deprecated_attribute in deprecated_attributes:
71
- if deprecated_attribute in values:
72
- values.pop(deprecated_attribute)
73
- return values
80
+ if deprecated_attribute in data:
81
+ data.pop(deprecated_attribute)
82
+
83
+ return data
74
84
 
75
- @validator("materializer_source", pre=True)
85
+ @field_validator("materializer_source", mode="before")
86
+ @classmethod
76
87
  def _convert_source(
77
88
  cls,
78
89
  value: Union[None, Source, Dict[str, Any], str, Tuple[Source, ...]],
@@ -88,7 +99,7 @@ class PartialArtifactConfiguration(StrictBaseModel):
88
99
  if isinstance(value, str):
89
100
  value = (Source.from_import_path(value),)
90
101
  elif isinstance(value, dict):
91
- value = (Source.parse_obj(value),)
102
+ value = (Source.model_validate(value),)
92
103
  elif isinstance(value, Source):
93
104
  value = (value,)
94
105
 
@@ -100,7 +111,8 @@ class ArtifactConfiguration(PartialArtifactConfiguration):
100
111
 
101
112
  materializer_source: Tuple[Source, ...]
102
113
 
103
- @validator("materializer_source", pre=True)
114
+ @field_validator("materializer_source", mode="before")
115
+ @classmethod
104
116
  def _convert_source(
105
117
  cls, value: Union[Source, Dict[str, Any], str, Tuple[Source, ...]]
106
118
  ) -> Tuple[Source, ...]:
@@ -115,7 +127,7 @@ class ArtifactConfiguration(PartialArtifactConfiguration):
115
127
  if isinstance(value, str):
116
128
  value = (Source.from_import_path(value),)
117
129
  elif isinstance(value, dict):
118
- value = (Source.parse_obj(value),)
130
+ value = (Source.model_validate(value),)
119
131
  elif isinstance(value, Source):
120
132
  value = (value,)
121
133
 
@@ -133,18 +145,15 @@ class StepConfigurationUpdate(StrictBaseModel):
133
145
  step_operator: Optional[str] = None
134
146
  experiment_tracker: Optional[str] = None
135
147
  parameters: Dict[str, Any] = {}
136
- settings: Dict[str, BaseSettings] = {}
148
+ settings: Dict[str, SerializeAsAny[BaseSettings]] = {}
137
149
  extra: Dict[str, Any] = {}
138
- failure_hook_source: Optional[Source] = None
139
- success_hook_source: Optional[Source] = None
150
+ failure_hook_source: Optional[SourceWithValidator] = None
151
+ success_hook_source: Optional[SourceWithValidator] = None
140
152
  model: Optional[Model] = None
141
153
  retry: Optional[StepRetryConfig] = None
142
154
 
143
155
  outputs: Mapping[str, PartialArtifactConfiguration] = {}
144
156
 
145
- _convert_source = convert_source_validator(
146
- "failure_hook_source", "success_hook_source"
147
- )
148
157
  _deprecation_validator = deprecation_utils.deprecate_pydantic_attributes(
149
158
  "name"
150
159
  )
@@ -160,27 +169,37 @@ class PartialStepConfiguration(StepConfigurationUpdate):
160
169
  client_lazy_loaders: Mapping[str, ClientLazyLoader] = {}
161
170
  outputs: Mapping[str, PartialArtifactConfiguration] = {}
162
171
 
172
+ # TODO: In Pydantic v2, the `model_` is a protected namespaces for all
173
+ # fields defined under base models. If not handled, this raises a warning.
174
+ # It is possible to suppress this warning message with the following
175
+ # configuration, however the ultimate solution is to rename these fields.
176
+ # Even though they do not cause any problems right now, if we are not
177
+ # careful we might overwrite some fields protected by pydantic.
178
+ model_config = ConfigDict(protected_namespaces=())
179
+
163
180
  # Override the deprecation validator as we do not want to deprecate the
164
181
  # `name`` attribute on this class.
165
182
  _deprecation_validator = deprecation_utils.deprecate_pydantic_attributes()
166
183
 
167
- @root_validator(pre=True)
168
- def _remove_deprecated_attributes(
169
- cls, values: Dict[str, Any]
170
- ) -> Dict[str, Any]:
184
+ @model_validator(mode="before")
185
+ @classmethod
186
+ @before_validator_handler
187
+ def _remove_deprecated_attributes(cls, data: Any) -> Any:
171
188
  """Removes deprecated attributes from the values dict.
172
189
 
173
190
  Args:
174
- values: The values dict used to instantiate the model.
191
+ data: The values dict used to instantiate the model.
175
192
 
176
193
  Returns:
177
194
  The values dict without deprecated attributes.
178
195
  """
179
196
  deprecated_attributes = ["docstring", "inputs"]
197
+
180
198
  for deprecated_attribute in deprecated_attributes:
181
- if deprecated_attribute in values:
182
- values.pop(deprecated_attribute)
183
- return values
199
+ if deprecated_attribute in data:
200
+ data.pop(deprecated_attribute)
201
+
202
+ return data
184
203
 
185
204
 
186
205
  class StepConfiguration(PartialStepConfiguration):
@@ -200,7 +219,10 @@ class StepConfiguration(PartialStepConfiguration):
200
219
  model_or_dict: SettingsOrDict = self.settings.get(
201
220
  RESOURCE_SETTINGS_KEY, {}
202
221
  )
203
- return ResourceSettings.parse_obj(model_or_dict)
222
+
223
+ if isinstance(model_or_dict, BaseSettings):
224
+ model_or_dict = model_or_dict.model_dump()
225
+ return ResourceSettings.model_validate(model_or_dict)
204
226
 
205
227
  @property
206
228
  def docker_settings(self) -> "DockerSettings":
@@ -214,7 +236,9 @@ class StepConfiguration(PartialStepConfiguration):
214
236
  model_or_dict: SettingsOrDict = self.settings.get(
215
237
  DOCKER_SETTINGS_KEY, {}
216
238
  )
217
- return DockerSettings.parse_obj(model_or_dict)
239
+ if isinstance(model_or_dict, BaseSettings):
240
+ model_or_dict = model_or_dict.model_dump()
241
+ return DockerSettings.model_validate(model_or_dict)
218
242
 
219
243
 
220
244
  class InputSpec(StrictBaseModel):
@@ -227,14 +251,12 @@ class InputSpec(StrictBaseModel):
227
251
  class StepSpec(StrictBaseModel):
228
252
  """Specification of a pipeline."""
229
253
 
230
- source: Source
254
+ source: SourceWithValidator
231
255
  upstream_steps: List[str]
232
256
  inputs: Dict[str, InputSpec] = {}
233
257
  # The default value is to ensure compatibility with specs of version <0.2
234
258
  pipeline_parameter_name: str = ""
235
259
 
236
- _convert_source = convert_source_validator("source")
237
-
238
260
  def __eq__(self, other: Any) -> bool:
239
261
  """Returns whether the other object is referring to the same step.
240
262
 
@@ -15,11 +15,12 @@
15
15
 
16
16
  from typing import Any, Dict, Optional
17
17
 
18
- from pydantic import BaseModel, root_validator
18
+ from pydantic import BaseModel, ConfigDict, SerializeAsAny, model_validator
19
19
 
20
20
  from zenml.config.secrets_store_config import SecretsStoreConfiguration
21
21
  from zenml.enums import StoreType
22
22
  from zenml.logger import get_logger
23
+ from zenml.utils.pydantic_utils import before_validator_handler
23
24
 
24
25
  logger = get_logger(__name__)
25
26
 
@@ -43,8 +44,10 @@ class StoreConfiguration(BaseModel):
43
44
 
44
45
  type: StoreType
45
46
  url: str
46
- secrets_store: Optional[SecretsStoreConfiguration] = None
47
- backup_secrets_store: Optional[SecretsStoreConfiguration] = None
47
+ secrets_store: Optional[SerializeAsAny[SecretsStoreConfiguration]] = None
48
+ backup_secrets_store: Optional[
49
+ SerializeAsAny[SecretsStoreConfiguration]
50
+ ] = None
48
51
 
49
52
  @classmethod
50
53
  def supports_url_scheme(cls, url: str) -> bool:
@@ -61,38 +64,36 @@ class StoreConfiguration(BaseModel):
61
64
  """
62
65
  return True
63
66
 
64
- @root_validator(pre=True)
65
- def validate_secrets_store(cls, values: Dict[str, Any]) -> Dict[str, Any]:
67
+ @model_validator(mode="before")
68
+ @classmethod
69
+ @before_validator_handler
70
+ def validate_store_config(cls, data: Dict[str, Any]) -> Dict[str, Any]:
66
71
  """Validate the secrets store configuration.
67
72
 
68
73
  Args:
69
- values: The values of the store configuration.
74
+ data: The values of the store configuration.
70
75
 
71
76
  Returns:
72
77
  The values of the store configuration.
73
78
  """
74
- if values.get("secrets_store") is None:
75
- return values
79
+ if data.get("secrets_store") is None:
80
+ return data
76
81
 
77
82
  # Remove the legacy REST secrets store configuration since it is no
78
83
  # longer supported/needed
79
- secrets_store = values["secrets_store"]
84
+ secrets_store = data["secrets_store"]
80
85
  if isinstance(secrets_store, dict):
81
86
  secrets_store_type = secrets_store.get("type")
82
87
  if secrets_store_type == "rest":
83
- del values["secrets_store"]
84
-
85
- return values
88
+ del data["secrets_store"]
86
89
 
87
- class Config:
88
- """Pydantic configuration class."""
90
+ return data
89
91
 
92
+ model_config = ConfigDict(
90
93
  # Validate attributes when assigning them. We need to set this in order
91
94
  # to have a mix of mutable and immutable attributes
92
- validate_assignment = True
95
+ validate_assignment=True,
93
96
  # Allow extra attributes to be set in the base class. The concrete
94
97
  # classes are responsible for validating the attributes.
95
- extra = "allow"
96
- # all attributes with leading underscore are private and therefore
97
- # are mutable and not included in serialization
98
- underscore_attrs_are_private = True
98
+ extra="allow",
99
+ )
@@ -13,14 +13,10 @@
13
13
  # permissions and limitations under the License.
14
14
  """Strict immutable pydantic model."""
15
15
 
16
- from pydantic import BaseModel, Extra
16
+ from pydantic import BaseModel, ConfigDict
17
17
 
18
18
 
19
19
  class StrictBaseModel(BaseModel):
20
20
  """Immutable pydantic model which prevents extra attributes."""
21
21
 
22
- class Config:
23
- """Pydantic config class."""
24
-
25
- allow_mutation = False
26
- extra = Extra.forbid
22
+ model_config = ConfigDict(frozen=True, extra="forbid")
zenml/constants.py CHANGED
@@ -69,6 +69,30 @@ def handle_json_env_var(
69
69
  return default
70
70
 
71
71
 
72
+ def is_true_string_value(value: Any) -> bool:
73
+ """Checks if the given value is a string representation of 'True'.
74
+
75
+ Args:
76
+ value: the value to check.
77
+
78
+ Returns:
79
+ Whether the input value represents a string version of 'True'.
80
+ """
81
+ return value in ["1", "y", "yes", "True", "true"]
82
+
83
+
84
+ def is_false_string_value(value: Any) -> bool:
85
+ """Checks if the given value is a string representation of 'False'.
86
+
87
+ Args:
88
+ value: the value to check.
89
+
90
+ Returns:
91
+ Whether the input value represents a string version of 'False'.
92
+ """
93
+ return value in ["0", "n", "no", "False", "false"]
94
+
95
+
72
96
  def handle_bool_env_var(var: str, default: bool = False) -> bool:
73
97
  """Converts normal env var to boolean.
74
98
 
@@ -80,9 +104,9 @@ def handle_bool_env_var(var: str, default: bool = False) -> bool:
80
104
  The converted value.
81
105
  """
82
106
  value = os.getenv(var)
83
- if value in ["1", "y", "yes", "True", "true"]:
107
+ if is_true_string_value(value):
84
108
  return True
85
- elif value in ["0", "n", "no", "False", "false"]:
109
+ elif is_false_string_value(value):
86
110
  return False
87
111
  return default
88
112
 
@@ -16,7 +16,7 @@
16
16
  import re
17
17
  from typing import TYPE_CHECKING, Optional, Tuple, Type, cast
18
18
 
19
- from pydantic import validator
19
+ from pydantic import field_validator
20
20
 
21
21
  from zenml.constants import DOCKER_REGISTRY_RESOURCE_TYPE
22
22
  from zenml.enums import StackComponentType
@@ -42,7 +42,8 @@ class BaseContainerRegistryConfig(AuthenticationConfigMixin):
42
42
 
43
43
  uri: str
44
44
 
45
- @validator("uri")
45
+ @field_validator("uri")
46
+ @classmethod
46
47
  def strip_trailing_slash(cls, uri: str) -> str:
47
48
  """Removes trailing slashes from the URI.
48
49