zenml-nightly 0.58.2.dev20240617__py3-none-any.whl → 0.58.2.dev20240619__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- zenml/VERSION +1 -1
- zenml/_hub/client.py +8 -5
- zenml/actions/base_action.py +8 -10
- zenml/artifact_stores/base_artifact_store.py +20 -15
- zenml/artifact_stores/local_artifact_store.py +3 -2
- zenml/artifacts/artifact_config.py +34 -19
- zenml/artifacts/external_artifact.py +18 -8
- zenml/artifacts/external_artifact_config.py +14 -6
- zenml/artifacts/unmaterialized_artifact.py +2 -11
- zenml/cli/__init__.py +6 -0
- zenml/cli/artifact.py +20 -2
- zenml/cli/served_model.py +0 -1
- zenml/cli/server.py +3 -3
- zenml/cli/utils.py +36 -40
- zenml/cli/web_login.py +2 -2
- zenml/client.py +198 -24
- zenml/client_lazy_loader.py +20 -14
- zenml/config/base_settings.py +5 -6
- zenml/config/build_configuration.py +1 -1
- zenml/config/compiler.py +3 -3
- zenml/config/docker_settings.py +27 -28
- zenml/config/global_config.py +33 -37
- zenml/config/pipeline_configurations.py +8 -11
- zenml/config/pipeline_run_configuration.py +6 -2
- zenml/config/pipeline_spec.py +3 -4
- zenml/config/resource_settings.py +8 -9
- zenml/config/schedule.py +16 -20
- zenml/config/secret_reference_mixin.py +6 -3
- zenml/config/secrets_store_config.py +16 -23
- zenml/config/server_config.py +50 -46
- zenml/config/settings_resolver.py +1 -1
- zenml/config/source.py +45 -35
- zenml/config/step_configurations.py +53 -31
- zenml/config/step_run_info.py +3 -0
- zenml/config/store_config.py +20 -19
- zenml/config/strict_base_model.py +2 -6
- zenml/constants.py +26 -2
- zenml/container_registries/base_container_registry.py +3 -2
- zenml/container_registries/default_container_registry.py +3 -3
- zenml/event_hub/base_event_hub.py +1 -1
- zenml/event_sources/base_event_source.py +11 -16
- zenml/exceptions.py +4 -0
- zenml/integrations/airflow/__init__.py +2 -6
- zenml/integrations/airflow/flavors/airflow_orchestrator_flavor.py +6 -7
- zenml/integrations/airflow/orchestrators/airflow_orchestrator.py +13 -249
- zenml/integrations/airflow/orchestrators/dag_generator.py +5 -3
- zenml/integrations/argilla/flavors/argilla_annotator_flavor.py +5 -4
- zenml/integrations/aws/__init__.py +1 -1
- zenml/integrations/aws/flavors/aws_container_registry_flavor.py +3 -2
- zenml/integrations/aws/flavors/sagemaker_orchestrator_flavor.py +11 -5
- zenml/integrations/aws/flavors/sagemaker_step_operator_flavor.py +6 -2
- zenml/integrations/aws/service_connectors/aws_service_connector.py +5 -4
- zenml/integrations/aws/step_operators/sagemaker_step_operator.py +1 -1
- zenml/integrations/azure/flavors/azureml_step_operator_flavor.py +4 -4
- zenml/integrations/azure/service_connectors/azure_service_connector.py +4 -3
- zenml/integrations/azure/step_operators/azureml_step_operator.py +2 -1
- zenml/integrations/bentoml/steps/bentoml_deployer.py +1 -1
- zenml/integrations/bitbucket/plugins/event_sources/bitbucket_webhook_event_source.py +8 -12
- zenml/integrations/comet/flavors/comet_experiment_tracker_flavor.py +1 -1
- zenml/integrations/constants.py +0 -1
- zenml/integrations/deepchecks/__init__.py +1 -0
- zenml/integrations/evidently/__init__.py +5 -3
- zenml/integrations/evidently/column_mapping.py +11 -3
- zenml/integrations/evidently/data_validators/evidently_data_validator.py +21 -3
- zenml/integrations/evidently/metrics.py +5 -6
- zenml/integrations/evidently/tests.py +5 -6
- zenml/integrations/facets/models.py +2 -6
- zenml/integrations/feast/__init__.py +3 -1
- zenml/integrations/feast/feature_stores/feast_feature_store.py +0 -23
- zenml/integrations/gcp/__init__.py +1 -1
- zenml/integrations/gcp/flavors/vertex_orchestrator_flavor.py +1 -1
- zenml/integrations/gcp/flavors/vertex_step_operator_flavor.py +1 -1
- zenml/integrations/gcp/orchestrators/vertex_orchestrator.py +234 -103
- zenml/integrations/gcp/service_connectors/gcp_service_connector.py +57 -42
- zenml/integrations/gcp/step_operators/vertex_step_operator.py +1 -0
- zenml/integrations/github/code_repositories/github_code_repository.py +1 -1
- zenml/integrations/github/plugins/event_sources/github_webhook_event_source.py +9 -13
- zenml/integrations/great_expectations/__init__.py +1 -1
- zenml/integrations/great_expectations/data_validators/ge_data_validator.py +44 -44
- zenml/integrations/great_expectations/flavors/great_expectations_data_validator_flavor.py +35 -2
- zenml/integrations/great_expectations/ge_store_backend.py +24 -11
- zenml/integrations/great_expectations/materializers/ge_materializer.py +3 -3
- zenml/integrations/great_expectations/utils.py +5 -5
- zenml/integrations/huggingface/__init__.py +3 -0
- zenml/integrations/huggingface/flavors/huggingface_model_deployer_flavor.py +1 -1
- zenml/integrations/huggingface/steps/__init__.py +3 -0
- zenml/integrations/huggingface/steps/accelerate_runner.py +149 -0
- zenml/integrations/huggingface/steps/huggingface_deployer.py +2 -2
- zenml/integrations/hyperai/flavors/hyperai_orchestrator_flavor.py +1 -1
- zenml/integrations/hyperai/service_connectors/hyperai_service_connector.py +4 -3
- zenml/integrations/kubeflow/__init__.py +1 -1
- zenml/integrations/kubeflow/flavors/kubeflow_orchestrator_flavor.py +48 -81
- zenml/integrations/kubeflow/orchestrators/kubeflow_orchestrator.py +295 -245
- zenml/integrations/kubernetes/flavors/kubernetes_orchestrator_flavor.py +1 -1
- zenml/integrations/kubernetes/orchestrators/kubernetes_orchestrator_entrypoint.py +11 -2
- zenml/integrations/kubernetes/pod_settings.py +17 -31
- zenml/integrations/kubernetes/service_connectors/kubernetes_service_connector.py +8 -7
- zenml/integrations/label_studio/__init__.py +1 -3
- zenml/integrations/label_studio/annotators/label_studio_annotator.py +3 -4
- zenml/integrations/label_studio/flavors/label_studio_annotator_flavor.py +2 -2
- zenml/integrations/langchain/__init__.py +5 -1
- zenml/integrations/langchain/materializers/document_materializer.py +44 -8
- zenml/integrations/mlflow/__init__.py +9 -3
- zenml/integrations/mlflow/experiment_trackers/mlflow_experiment_tracker.py +1 -1
- zenml/integrations/mlflow/flavors/mlflow_experiment_tracker_flavor.py +29 -37
- zenml/integrations/mlflow/model_registries/mlflow_model_registry.py +4 -4
- zenml/integrations/mlflow/steps/mlflow_deployer.py +1 -1
- zenml/integrations/neptune/flavors/neptune_experiment_tracker_flavor.py +1 -1
- zenml/integrations/neural_prophet/__init__.py +5 -1
- zenml/integrations/pigeon/flavors/pigeon_annotator_flavor.py +1 -1
- zenml/integrations/s3/flavors/s3_artifact_store_flavor.py +9 -8
- zenml/integrations/seldon/seldon_client.py +52 -67
- zenml/integrations/seldon/services/seldon_deployment.py +3 -3
- zenml/integrations/seldon/steps/seldon_deployer.py +4 -4
- zenml/integrations/skypilot/flavors/skypilot_orchestrator_base_vm_config.py +15 -5
- zenml/integrations/skypilot_aws/__init__.py +1 -1
- zenml/integrations/skypilot_aws/flavors/skypilot_orchestrator_aws_vm_flavor.py +1 -1
- zenml/integrations/skypilot_azure/__init__.py +1 -1
- zenml/integrations/skypilot_azure/flavors/skypilot_orchestrator_azure_vm_flavor.py +1 -1
- zenml/integrations/skypilot_gcp/__init__.py +2 -1
- zenml/integrations/skypilot_gcp/flavors/skypilot_orchestrator_gcp_vm_flavor.py +1 -1
- zenml/integrations/skypilot_lambda/flavors/skypilot_orchestrator_lambda_vm_flavor.py +2 -2
- zenml/integrations/spark/flavors/spark_step_operator_flavor.py +1 -1
- zenml/integrations/spark/step_operators/spark_step_operator.py +2 -0
- zenml/integrations/tekton/__init__.py +1 -1
- zenml/integrations/tekton/flavors/tekton_orchestrator_flavor.py +66 -23
- zenml/integrations/tekton/orchestrators/tekton_orchestrator.py +547 -233
- zenml/integrations/tensorboard/__init__.py +1 -12
- zenml/integrations/tensorboard/services/tensorboard_service.py +3 -5
- zenml/integrations/tensorboard/visualizers/tensorboard_visualizer.py +6 -6
- zenml/integrations/tensorflow/__init__.py +2 -10
- zenml/integrations/tensorflow/materializers/keras_materializer.py +17 -9
- zenml/integrations/wandb/flavors/wandb_experiment_tracker_flavor.py +9 -14
- zenml/integrations/whylogs/flavors/whylogs_data_validator_flavor.py +1 -1
- zenml/lineage_graph/lineage_graph.py +1 -1
- zenml/logging/step_logging.py +15 -7
- zenml/materializers/built_in_materializer.py +3 -3
- zenml/materializers/pydantic_materializer.py +2 -2
- zenml/metadata/lazy_load.py +4 -4
- zenml/metadata/metadata_types.py +64 -4
- zenml/model/model.py +79 -54
- zenml/model_deployers/base_model_deployer.py +14 -12
- zenml/model_registries/base_model_registry.py +17 -15
- zenml/models/__init__.py +79 -206
- zenml/models/v2/base/base.py +54 -41
- zenml/models/v2/base/base_plugin_flavor.py +2 -6
- zenml/models/v2/base/filter.py +91 -76
- zenml/models/v2/base/page.py +2 -12
- zenml/models/v2/base/scoped.py +4 -7
- zenml/models/v2/core/api_key.py +22 -8
- zenml/models/v2/core/artifact.py +2 -2
- zenml/models/v2/core/artifact_version.py +74 -40
- zenml/models/v2/core/code_repository.py +37 -10
- zenml/models/v2/core/component.py +65 -16
- zenml/models/v2/core/device.py +14 -4
- zenml/models/v2/core/event_source.py +1 -2
- zenml/models/v2/core/flavor.py +74 -8
- zenml/models/v2/core/logs.py +68 -8
- zenml/models/v2/core/model.py +8 -4
- zenml/models/v2/core/model_version.py +25 -6
- zenml/models/v2/core/model_version_artifact.py +51 -21
- zenml/models/v2/core/model_version_pipeline_run.py +45 -13
- zenml/models/v2/core/pipeline.py +37 -72
- zenml/models/v2/core/pipeline_build.py +29 -17
- zenml/models/v2/core/pipeline_deployment.py +18 -6
- zenml/models/v2/core/pipeline_namespace.py +113 -0
- zenml/models/v2/core/pipeline_run.py +50 -22
- zenml/models/v2/core/run_metadata.py +59 -36
- zenml/models/v2/core/schedule.py +37 -24
- zenml/models/v2/core/secret.py +31 -12
- zenml/models/v2/core/service.py +64 -36
- zenml/models/v2/core/service_account.py +24 -11
- zenml/models/v2/core/service_connector.py +219 -44
- zenml/models/v2/core/stack.py +45 -17
- zenml/models/v2/core/step_run.py +28 -8
- zenml/models/v2/core/tag.py +8 -4
- zenml/models/v2/core/trigger.py +2 -2
- zenml/models/v2/core/trigger_execution.py +1 -0
- zenml/models/v2/core/user.py +18 -21
- zenml/models/v2/core/workspace.py +13 -3
- zenml/models/v2/misc/build_item.py +3 -3
- zenml/models/v2/misc/external_user.py +2 -6
- zenml/models/v2/misc/hub_plugin_models.py +9 -9
- zenml/models/v2/misc/loaded_visualization.py +2 -2
- zenml/models/v2/misc/service_connector_type.py +8 -17
- zenml/models/v2/misc/user_auth.py +7 -2
- zenml/new/pipelines/build_utils.py +3 -3
- zenml/new/pipelines/pipeline.py +17 -13
- zenml/new/pipelines/run_utils.py +103 -1
- zenml/orchestrators/base_orchestrator.py +10 -7
- zenml/orchestrators/local_docker/local_docker_orchestrator.py +1 -1
- zenml/orchestrators/step_launcher.py +28 -4
- zenml/orchestrators/step_runner.py +3 -6
- zenml/orchestrators/utils.py +1 -1
- zenml/plugins/base_plugin_flavor.py +6 -10
- zenml/plugins/plugin_flavor_registry.py +3 -7
- zenml/secret/base_secret.py +7 -8
- zenml/service_connectors/docker_service_connector.py +4 -3
- zenml/service_connectors/service_connector.py +5 -12
- zenml/service_connectors/service_connector_registry.py +2 -4
- zenml/services/container/container_service.py +1 -1
- zenml/services/container/container_service_endpoint.py +1 -1
- zenml/services/local/local_service.py +1 -1
- zenml/services/local/local_service_endpoint.py +1 -1
- zenml/services/service.py +16 -10
- zenml/services/service_type.py +4 -5
- zenml/services/terraform/terraform_service.py +1 -1
- zenml/stack/flavor.py +1 -5
- zenml/stack/flavor_registry.py +4 -4
- zenml/stack/stack.py +4 -1
- zenml/stack/stack_component.py +55 -31
- zenml/step_operators/step_operator_entrypoint_configuration.py +1 -0
- zenml/steps/base_step.py +34 -28
- zenml/steps/entrypoint_function_utils.py +3 -5
- zenml/steps/utils.py +12 -14
- zenml/utils/cuda_utils.py +50 -0
- zenml/utils/deprecation_utils.py +18 -20
- zenml/utils/dict_utils.py +1 -1
- zenml/utils/filesync_model.py +65 -28
- zenml/utils/function_utils.py +260 -0
- zenml/utils/json_utils.py +131 -0
- zenml/utils/mlstacks_utils.py +2 -2
- zenml/utils/pipeline_docker_image_builder.py +9 -0
- zenml/utils/pydantic_utils.py +270 -62
- zenml/utils/secret_utils.py +65 -12
- zenml/utils/source_utils.py +2 -2
- zenml/utils/typed_model.py +5 -3
- zenml/utils/typing_utils.py +243 -0
- zenml/utils/yaml_utils.py +1 -1
- zenml/zen_server/auth.py +2 -2
- zenml/zen_server/cloud_utils.py +6 -6
- zenml/zen_server/deploy/base_provider.py +1 -1
- zenml/zen_server/deploy/deployment.py +6 -8
- zenml/zen_server/deploy/docker/docker_zen_server.py +3 -4
- zenml/zen_server/deploy/local/local_provider.py +0 -1
- zenml/zen_server/deploy/local/local_zen_server.py +6 -6
- zenml/zen_server/deploy/terraform/terraform_zen_server.py +4 -6
- zenml/zen_server/exceptions.py +4 -1
- zenml/zen_server/feature_gate/zenml_cloud_feature_gate.py +1 -1
- zenml/zen_server/pipeline_deployment/utils.py +48 -68
- zenml/zen_server/rbac/models.py +2 -5
- zenml/zen_server/rbac/utils.py +11 -14
- zenml/zen_server/routers/auth_endpoints.py +2 -2
- zenml/zen_server/routers/pipeline_builds_endpoints.py +1 -1
- zenml/zen_server/routers/runs_endpoints.py +1 -1
- zenml/zen_server/routers/secrets_endpoints.py +3 -2
- zenml/zen_server/routers/server_endpoints.py +1 -1
- zenml/zen_server/routers/steps_endpoints.py +1 -1
- zenml/zen_server/routers/workspaces_endpoints.py +1 -1
- zenml/zen_stores/base_zen_store.py +46 -9
- zenml/zen_stores/migrations/utils.py +42 -46
- zenml/zen_stores/migrations/versions/0701da9951a0_added_service_table.py +1 -1
- zenml/zen_stores/migrations/versions/1041bc644e0d_remove_secrets_manager.py +5 -3
- zenml/zen_stores/migrations/versions/10a907dad202_delete_mlmd_tables.py +1 -1
- zenml/zen_stores/migrations/versions/26b776ad583e_redesign_artifacts.py +8 -10
- zenml/zen_stores/migrations/versions/37835ce041d2_optimizing_database.py +3 -3
- zenml/zen_stores/migrations/versions/46506f72f0ed_add_server_settings.py +10 -12
- zenml/zen_stores/migrations/versions/5994f9ad0489_introduce_role_permissions.py +3 -2
- zenml/zen_stores/migrations/versions/6917bce75069_add_pipeline_run_unique_constraint.py +4 -4
- zenml/zen_stores/migrations/versions/728c6369cfaa_add_name_column_to_input_artifact_pk.py +3 -2
- zenml/zen_stores/migrations/versions/743ec82b1b3c_update_size_of_build_images.py +2 -2
- zenml/zen_stores/migrations/versions/7500f434b71c_remove_shared_columns.py +3 -2
- zenml/zen_stores/migrations/versions/7834208cc3f6_artifact_project_scoping.py +8 -7
- zenml/zen_stores/migrations/versions/7b651bf6822e_track_secrets_in_db.py +6 -4
- zenml/zen_stores/migrations/versions/7e4a481d17f7_add_identity_table.py +2 -2
- zenml/zen_stores/migrations/versions/7f603e583dd7_fixed_migration.py +1 -1
- zenml/zen_stores/migrations/versions/a39c4184c8ce_remove_secrets_manager_flavors.py +2 -2
- zenml/zen_stores/migrations/versions/a91762e6be36_artifact_version_table.py +4 -4
- zenml/zen_stores/migrations/versions/alembic_start.py +1 -1
- zenml/zen_stores/migrations/versions/fbd7f18ced1e_increase_step_run_field_lengths.py +4 -4
- zenml/zen_stores/rest_zen_store.py +109 -49
- zenml/zen_stores/schemas/api_key_schemas.py +1 -1
- zenml/zen_stores/schemas/artifact_schemas.py +8 -8
- zenml/zen_stores/schemas/artifact_visualization_schemas.py +3 -3
- zenml/zen_stores/schemas/code_repository_schemas.py +1 -1
- zenml/zen_stores/schemas/component_schemas.py +8 -3
- zenml/zen_stores/schemas/device_schemas.py +8 -6
- zenml/zen_stores/schemas/event_source_schemas.py +3 -4
- zenml/zen_stores/schemas/flavor_schemas.py +5 -3
- zenml/zen_stores/schemas/model_schemas.py +26 -1
- zenml/zen_stores/schemas/pipeline_build_schemas.py +1 -1
- zenml/zen_stores/schemas/pipeline_deployment_schemas.py +4 -4
- zenml/zen_stores/schemas/pipeline_run_schemas.py +6 -6
- zenml/zen_stores/schemas/pipeline_schemas.py +5 -2
- zenml/zen_stores/schemas/run_metadata_schemas.py +2 -2
- zenml/zen_stores/schemas/secret_schemas.py +8 -5
- zenml/zen_stores/schemas/server_settings_schemas.py +3 -1
- zenml/zen_stores/schemas/service_connector_schemas.py +1 -1
- zenml/zen_stores/schemas/service_schemas.py +11 -2
- zenml/zen_stores/schemas/stack_schemas.py +1 -1
- zenml/zen_stores/schemas/step_run_schemas.py +11 -11
- zenml/zen_stores/schemas/tag_schemas.py +6 -2
- zenml/zen_stores/schemas/trigger_schemas.py +2 -2
- zenml/zen_stores/schemas/user_schemas.py +2 -2
- zenml/zen_stores/schemas/workspace_schemas.py +3 -1
- zenml/zen_stores/secrets_stores/aws_secrets_store.py +19 -20
- zenml/zen_stores/secrets_stores/azure_secrets_store.py +17 -20
- zenml/zen_stores/secrets_stores/base_secrets_store.py +79 -12
- zenml/zen_stores/secrets_stores/gcp_secrets_store.py +17 -20
- zenml/zen_stores/secrets_stores/hashicorp_secrets_store.py +4 -8
- zenml/zen_stores/secrets_stores/service_connector_secrets_store.py +10 -7
- zenml/zen_stores/secrets_stores/sql_secrets_store.py +5 -6
- zenml/zen_stores/sql_zen_store.py +196 -120
- zenml/zen_stores/zen_store_interface.py +33 -0
- {zenml_nightly-0.58.2.dev20240617.dist-info → zenml_nightly-0.58.2.dev20240619.dist-info}/METADATA +9 -7
- {zenml_nightly-0.58.2.dev20240617.dist-info → zenml_nightly-0.58.2.dev20240619.dist-info}/RECORD +309 -306
- zenml/integrations/kubeflow/utils.py +0 -95
- zenml/models/v2/base/internal.py +0 -37
- zenml/models/v2/base/update.py +0 -44
- {zenml_nightly-0.58.2.dev20240617.dist-info → zenml_nightly-0.58.2.dev20240619.dist-info}/LICENSE +0 -0
- {zenml_nightly-0.58.2.dev20240617.dist-info → zenml_nightly-0.58.2.dev20240619.dist-info}/WHEEL +0 -0
- {zenml_nightly-0.58.2.dev20240617.dist-info → zenml_nightly-0.58.2.dev20240619.dist-info}/entry_points.txt +0 -0
@@ -25,7 +25,7 @@ from uuid import UUID
|
|
25
25
|
|
26
26
|
import boto3
|
27
27
|
from botocore.exceptions import ClientError
|
28
|
-
from pydantic import
|
28
|
+
from pydantic import ConfigDict, model_validator
|
29
29
|
|
30
30
|
from zenml.enums import (
|
31
31
|
SecretsStoreType,
|
@@ -38,6 +38,7 @@ from zenml.integrations.aws.service_connectors.aws_service_connector import (
|
|
38
38
|
AWSAuthenticationMethods,
|
39
39
|
)
|
40
40
|
from zenml.logger import get_logger
|
41
|
+
from zenml.utils.pydantic_utils import before_validator_handler
|
41
42
|
from zenml.zen_stores.secrets_stores.service_connector_secrets_store import (
|
42
43
|
ServiceConnectorSecretsStore,
|
43
44
|
ServiceConnectorSecretsStoreConfiguration,
|
@@ -74,20 +75,22 @@ class AWSSecretsStoreConfiguration(ServiceConnectorSecretsStoreConfiguration):
|
|
74
75
|
|
75
76
|
raise ValueError("AWS `region` must be specified in the auth_config.")
|
76
77
|
|
77
|
-
@
|
78
|
-
|
78
|
+
@model_validator(mode="before")
|
79
|
+
@classmethod
|
80
|
+
@before_validator_handler
|
81
|
+
def populate_config(cls, data: Dict[str, Any]) -> Dict[str, Any]:
|
79
82
|
"""Populate the connector configuration from legacy attributes.
|
80
83
|
|
81
84
|
Args:
|
82
|
-
|
85
|
+
data: Dict representing user-specified runtime settings.
|
83
86
|
|
84
87
|
Returns:
|
85
88
|
Validated settings.
|
86
89
|
"""
|
87
90
|
# Search for legacy attributes and populate the connector configuration
|
88
91
|
# from them, if they exist.
|
89
|
-
if
|
90
|
-
if not
|
92
|
+
if data.get("region_name"):
|
93
|
+
if not data.get("aws_access_key_id") or not data.get(
|
91
94
|
"aws_secret_access_key"
|
92
95
|
):
|
93
96
|
logger.warning(
|
@@ -96,9 +99,9 @@ class AWSSecretsStoreConfiguration(ServiceConnectorSecretsStoreConfiguration):
|
|
96
99
|
"the `auth_method` and `auth_config` attributes instead. "
|
97
100
|
"Using an implicit authentication method for AWS Secrets."
|
98
101
|
)
|
99
|
-
|
100
|
-
|
101
|
-
region=
|
102
|
+
data["auth_method"] = AWSAuthenticationMethods.IMPLICIT
|
103
|
+
data["auth_config"] = dict(
|
104
|
+
region=data.get("region_name"),
|
102
105
|
)
|
103
106
|
else:
|
104
107
|
logger.warning(
|
@@ -107,20 +110,16 @@ class AWSSecretsStoreConfiguration(ServiceConnectorSecretsStoreConfiguration):
|
|
107
110
|
"will be removed in a future version of ZenML. Please use the "
|
108
111
|
"`auth_method` and `auth_config` attributes instead."
|
109
112
|
)
|
110
|
-
|
111
|
-
|
112
|
-
aws_access_key_id=
|
113
|
-
aws_secret_access_key=
|
114
|
-
region=
|
113
|
+
data["auth_method"] = AWSAuthenticationMethods.SECRET_KEY
|
114
|
+
data["auth_config"] = dict(
|
115
|
+
aws_access_key_id=data.get("aws_access_key_id"),
|
116
|
+
aws_secret_access_key=data.get("aws_secret_access_key"),
|
117
|
+
region=data.get("region_name"),
|
115
118
|
)
|
116
119
|
|
117
|
-
return
|
120
|
+
return data
|
118
121
|
|
119
|
-
|
120
|
-
"""Pydantic configuration class."""
|
121
|
-
|
122
|
-
# Allow extra attributes set in the class.
|
123
|
-
extra = "allow"
|
122
|
+
model_config = ConfigDict(extra="allow")
|
124
123
|
|
125
124
|
|
126
125
|
class AWSSecretsStore(ServiceConnectorSecretsStore):
|
@@ -27,7 +27,7 @@ from uuid import UUID
|
|
27
27
|
from azure.core.credentials import TokenCredential
|
28
28
|
from azure.core.exceptions import HttpResponseError, ResourceNotFoundError
|
29
29
|
from azure.keyvault.secrets import SecretClient
|
30
|
-
from pydantic import
|
30
|
+
from pydantic import ConfigDict, model_validator
|
31
31
|
|
32
32
|
from zenml.enums import (
|
33
33
|
SecretsStoreType,
|
@@ -40,6 +40,7 @@ from zenml.integrations.azure.service_connectors.azure_service_connector import
|
|
40
40
|
AzureAuthenticationMethods,
|
41
41
|
)
|
42
42
|
from zenml.logger import get_logger
|
43
|
+
from zenml.utils.pydantic_utils import before_validator_handler
|
43
44
|
from zenml.zen_stores.secrets_stores.service_connector_secrets_store import (
|
44
45
|
ServiceConnectorSecretsStore,
|
45
46
|
ServiceConnectorSecretsStoreConfiguration,
|
@@ -65,12 +66,14 @@ class AzureSecretsStoreConfiguration(
|
|
65
66
|
type: SecretsStoreType = SecretsStoreType.AZURE
|
66
67
|
key_vault_name: str
|
67
68
|
|
68
|
-
@
|
69
|
-
|
69
|
+
@model_validator(mode="before")
|
70
|
+
@classmethod
|
71
|
+
@before_validator_handler
|
72
|
+
def populate_config(cls, data: Dict[str, Any]) -> Dict[str, Any]:
|
70
73
|
"""Populate the connector configuration from legacy attributes.
|
71
74
|
|
72
75
|
Args:
|
73
|
-
|
76
|
+
data: Dict representing user-specified runtime settings.
|
74
77
|
|
75
78
|
Returns:
|
76
79
|
Validated settings.
|
@@ -78,9 +81,9 @@ class AzureSecretsStoreConfiguration(
|
|
78
81
|
# Search for legacy attributes and populate the connector configuration
|
79
82
|
# from them, if they exist.
|
80
83
|
if (
|
81
|
-
|
82
|
-
and
|
83
|
-
and
|
84
|
+
data.get("azure_client_id")
|
85
|
+
and data.get("azure_client_secret")
|
86
|
+
and data.get("azure_tenant_id")
|
84
87
|
):
|
85
88
|
logger.warning(
|
86
89
|
"The `azure_client_id`, `azure_client_secret` and "
|
@@ -88,22 +91,16 @@ class AzureSecretsStoreConfiguration(
|
|
88
91
|
"removed in a future version or ZenML. Please use the "
|
89
92
|
"`auth_method` and `auth_config` attributes instead."
|
90
93
|
)
|
91
|
-
|
92
|
-
|
94
|
+
data["auth_method"] = AzureAuthenticationMethods.SERVICE_PRINCIPAL
|
95
|
+
data["auth_config"] = dict(
|
96
|
+
client_id=data.get("azure_client_id"),
|
97
|
+
client_secret=data.get("azure_client_secret"),
|
98
|
+
tenant_id=data.get("azure_tenant_id"),
|
93
99
|
)
|
94
|
-
values["auth_config"] = dict(
|
95
|
-
client_id=values.get("azure_client_id"),
|
96
|
-
client_secret=values.get("azure_client_secret"),
|
97
|
-
tenant_id=values.get("azure_tenant_id"),
|
98
|
-
)
|
99
|
-
|
100
|
-
return values
|
101
100
|
|
102
|
-
|
103
|
-
"""Pydantic configuration class."""
|
101
|
+
return data
|
104
102
|
|
105
|
-
|
106
|
-
extra = "allow"
|
103
|
+
model_config = ConfigDict(extra="allow")
|
107
104
|
|
108
105
|
|
109
106
|
class AzureSecretsStore(ServiceConnectorSecretsStore):
|
@@ -24,12 +24,13 @@ from typing import (
|
|
24
24
|
)
|
25
25
|
from uuid import UUID
|
26
26
|
|
27
|
-
from pydantic import BaseModel
|
27
|
+
from pydantic import BaseModel, ConfigDict, model_validator
|
28
28
|
|
29
29
|
from zenml.config.secrets_store_config import SecretsStoreConfiguration
|
30
30
|
from zenml.enums import SecretsStoreType
|
31
31
|
from zenml.logger import get_logger
|
32
32
|
from zenml.utils import source_utils
|
33
|
+
from zenml.utils.pydantic_utils import before_validator_handler
|
33
34
|
from zenml.zen_stores.secrets_stores.secrets_store_interface import (
|
34
35
|
SecretsStoreInterface,
|
35
36
|
)
|
@@ -58,6 +59,79 @@ class BaseSecretsStore(BaseModel, SecretsStoreInterface, ABC):
|
|
58
59
|
TYPE: ClassVar[SecretsStoreType]
|
59
60
|
CONFIG_TYPE: ClassVar[Type[SecretsStoreConfiguration]]
|
60
61
|
|
62
|
+
@model_validator(mode="before")
|
63
|
+
@classmethod
|
64
|
+
@before_validator_handler
|
65
|
+
def convert_config(cls, data: Dict[str, Any]) -> Dict[str, Any]:
|
66
|
+
"""Method to infer the correct type of the config and convert.
|
67
|
+
|
68
|
+
Args:
|
69
|
+
data: The provided configuration object, can potentially be a
|
70
|
+
generic object
|
71
|
+
|
72
|
+
Raises:
|
73
|
+
ValueError: If the provided config object's type does not match
|
74
|
+
any of the current implementations.
|
75
|
+
|
76
|
+
Returns:
|
77
|
+
The converted configuration object.
|
78
|
+
"""
|
79
|
+
if data["config"].type == SecretsStoreType.SQL:
|
80
|
+
from zenml.zen_stores.secrets_stores.sql_secrets_store import (
|
81
|
+
SqlSecretsStoreConfiguration,
|
82
|
+
)
|
83
|
+
|
84
|
+
data["config"] = SqlSecretsStoreConfiguration(
|
85
|
+
**data["config"].model_dump()
|
86
|
+
)
|
87
|
+
|
88
|
+
elif data["config"].type == SecretsStoreType.GCP:
|
89
|
+
from zenml.zen_stores.secrets_stores.gcp_secrets_store import (
|
90
|
+
GCPSecretsStoreConfiguration,
|
91
|
+
)
|
92
|
+
|
93
|
+
data["config"] = GCPSecretsStoreConfiguration(
|
94
|
+
**data["config"].model_dump()
|
95
|
+
)
|
96
|
+
|
97
|
+
elif data["config"].type == SecretsStoreType.AWS:
|
98
|
+
from zenml.zen_stores.secrets_stores.aws_secrets_store import (
|
99
|
+
AWSSecretsStoreConfiguration,
|
100
|
+
)
|
101
|
+
|
102
|
+
data["config"] = AWSSecretsStoreConfiguration(
|
103
|
+
**data["config"].model_dump()
|
104
|
+
)
|
105
|
+
|
106
|
+
elif data["config"].type == SecretsStoreType.AZURE:
|
107
|
+
from zenml.zen_stores.secrets_stores.azure_secrets_store import (
|
108
|
+
AzureSecretsStoreConfiguration,
|
109
|
+
)
|
110
|
+
|
111
|
+
data["config"] = AzureSecretsStoreConfiguration(
|
112
|
+
**data["config"].model_dump()
|
113
|
+
)
|
114
|
+
|
115
|
+
elif data["config"].type == SecretsStoreType.HASHICORP:
|
116
|
+
from zenml.zen_stores.secrets_stores.hashicorp_secrets_store import (
|
117
|
+
HashiCorpVaultSecretsStoreConfiguration,
|
118
|
+
)
|
119
|
+
|
120
|
+
data["config"] = HashiCorpVaultSecretsStoreConfiguration(
|
121
|
+
**data["config"].model_dump()
|
122
|
+
)
|
123
|
+
elif (
|
124
|
+
data["config"].type == SecretsStoreType.CUSTOM
|
125
|
+
or data["config"].type == SecretsStoreType.NONE
|
126
|
+
):
|
127
|
+
pass
|
128
|
+
else:
|
129
|
+
raise ValueError(
|
130
|
+
f"Unknown type '{data['config'].type}' for the configuration."
|
131
|
+
)
|
132
|
+
|
133
|
+
return data
|
134
|
+
|
61
135
|
# ---------------------------------
|
62
136
|
# Initialization and configuration
|
63
137
|
# ---------------------------------
|
@@ -297,14 +371,7 @@ class BaseSecretsStore(BaseModel, SecretsStoreInterface, ABC):
|
|
297
371
|
f"expected {secret_id}, got {stored_secret_id}"
|
298
372
|
)
|
299
373
|
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
# to have a mix of mutable and immutable attributes
|
305
|
-
validate_assignment = True
|
306
|
-
# Ignore extra attributes from configs of previous ZenML versions
|
307
|
-
extra = "ignore"
|
308
|
-
# all attributes with leading underscore are private and therefore
|
309
|
-
# are mutable and not included in serialization
|
310
|
-
underscore_attrs_are_private = True
|
374
|
+
model_config = ConfigDict(
|
375
|
+
validate_assignment=True,
|
376
|
+
extra="ignore",
|
377
|
+
)
|
@@ -27,7 +27,7 @@ from uuid import UUID
|
|
27
27
|
|
28
28
|
from google.api_core import exceptions as google_exceptions
|
29
29
|
from google.cloud.secretmanager import SecretManagerServiceClient
|
30
|
-
from pydantic import
|
30
|
+
from pydantic import ConfigDict, model_validator
|
31
31
|
|
32
32
|
from zenml.enums import (
|
33
33
|
SecretsStoreType,
|
@@ -40,6 +40,7 @@ from zenml.integrations.gcp.service_connectors.gcp_service_connector import (
|
|
40
40
|
GCPAuthenticationMethods,
|
41
41
|
)
|
42
42
|
from zenml.logger import get_logger
|
43
|
+
from zenml.utils.pydantic_utils import before_validator_handler
|
43
44
|
from zenml.zen_stores.secrets_stores.service_connector_secrets_store import (
|
44
45
|
ServiceConnectorSecretsStore,
|
45
46
|
ServiceConnectorSecretsStoreConfiguration,
|
@@ -78,19 +79,21 @@ class GCPSecretsStoreConfiguration(ServiceConnectorSecretsStoreConfiguration):
|
|
78
79
|
|
79
80
|
raise ValueError("GCP `project_id` must be specified in auth_config.")
|
80
81
|
|
81
|
-
@
|
82
|
-
|
82
|
+
@model_validator(mode="before")
|
83
|
+
@classmethod
|
84
|
+
@before_validator_handler
|
85
|
+
def populate_config(cls, data: Dict[str, Any]) -> Dict[str, Any]:
|
83
86
|
"""Populate the connector configuration from legacy attributes.
|
84
87
|
|
85
88
|
Args:
|
86
|
-
|
89
|
+
data: Dict representing user-specified runtime settings.
|
87
90
|
|
88
91
|
Returns:
|
89
92
|
Validated settings.
|
90
93
|
"""
|
91
94
|
# Search for legacy attributes and populate the connector configuration
|
92
95
|
# from them, if they exist.
|
93
|
-
if
|
96
|
+
if data.get("project_id"):
|
94
97
|
if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS"):
|
95
98
|
logger.warning(
|
96
99
|
"The `project_id` GCP secrets store attribute is "
|
@@ -99,9 +102,9 @@ class GCPSecretsStoreConfiguration(ServiceConnectorSecretsStoreConfiguration):
|
|
99
102
|
"instead. Using an implicit GCP authentication to access "
|
100
103
|
"the GCP Secrets Manager API."
|
101
104
|
)
|
102
|
-
|
103
|
-
|
104
|
-
project_id=
|
105
|
+
data["auth_method"] = GCPAuthenticationMethods.IMPLICIT
|
106
|
+
data["auth_config"] = dict(
|
107
|
+
project_id=data.get("project_id"),
|
105
108
|
)
|
106
109
|
else:
|
107
110
|
logger.warning(
|
@@ -111,23 +114,17 @@ class GCPSecretsStoreConfiguration(ServiceConnectorSecretsStoreConfiguration):
|
|
111
114
|
"Please use the `auth_method` and `auth_config` attributes "
|
112
115
|
"instead."
|
113
116
|
)
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
values["auth_config"] = dict(
|
118
|
-
project_id=values.get("project_id"),
|
117
|
+
data["auth_method"] = GCPAuthenticationMethods.SERVICE_ACCOUNT
|
118
|
+
data["auth_config"] = dict(
|
119
|
+
project_id=data.get("project_id"),
|
119
120
|
)
|
120
121
|
# Load the service account credentials from the file
|
121
122
|
with open(os.environ["GOOGLE_APPLICATION_CREDENTIALS"]) as f:
|
122
|
-
|
123
|
-
|
124
|
-
return values
|
123
|
+
data["auth_config"]["service_account_json"] = f.read()
|
125
124
|
|
126
|
-
|
127
|
-
"""Pydantic configuration class."""
|
125
|
+
return data
|
128
126
|
|
129
|
-
|
130
|
-
extra = "allow"
|
127
|
+
model_config = ConfigDict(extra="allow")
|
131
128
|
|
132
129
|
|
133
130
|
class GCPSecretsStore(ServiceConnectorSecretsStore):
|
@@ -26,13 +26,14 @@ from hvac.exceptions import ( # type: ignore[import-untyped]
|
|
26
26
|
InvalidPath,
|
27
27
|
VaultError,
|
28
28
|
)
|
29
|
-
from pydantic import
|
29
|
+
from pydantic import ConfigDict
|
30
30
|
|
31
31
|
from zenml.config.secrets_store_config import SecretsStoreConfiguration
|
32
32
|
from zenml.enums import (
|
33
33
|
SecretsStoreType,
|
34
34
|
)
|
35
35
|
from zenml.logger import get_logger
|
36
|
+
from zenml.utils.secret_utils import PlainSerializedSecretStr
|
36
37
|
from zenml.zen_stores.secrets_stores.base_secrets_store import (
|
37
38
|
BaseSecretsStore,
|
38
39
|
)
|
@@ -63,16 +64,11 @@ class HashiCorpVaultSecretsStoreConfiguration(SecretsStoreConfiguration):
|
|
63
64
|
type: SecretsStoreType = SecretsStoreType.HASHICORP
|
64
65
|
|
65
66
|
vault_addr: str
|
66
|
-
vault_token: Optional[
|
67
|
+
vault_token: Optional[PlainSerializedSecretStr] = None
|
67
68
|
vault_namespace: Optional[str] = None
|
68
69
|
mount_point: Optional[str] = None
|
69
70
|
max_versions: int = 1
|
70
|
-
|
71
|
-
class Config:
|
72
|
-
"""Pydantic configuration class."""
|
73
|
-
|
74
|
-
# Forbid extra attributes set in the class.
|
75
|
-
extra = "forbid"
|
71
|
+
model_config = ConfigDict(extra="forbid")
|
76
72
|
|
77
73
|
|
78
74
|
class HashiCorpVaultSecretsStore(BaseSecretsStore):
|
@@ -25,7 +25,7 @@ from typing import (
|
|
25
25
|
)
|
26
26
|
from uuid import uuid4
|
27
27
|
|
28
|
-
from pydantic import Field,
|
28
|
+
from pydantic import Field, model_validator
|
29
29
|
|
30
30
|
from zenml.config.secrets_store_config import SecretsStoreConfiguration
|
31
31
|
from zenml.logger import get_logger
|
@@ -36,6 +36,7 @@ from zenml.service_connectors.service_connector import ServiceConnector
|
|
36
36
|
from zenml.service_connectors.service_connector_registry import (
|
37
37
|
service_connector_registry,
|
38
38
|
)
|
39
|
+
from zenml.utils.pydantic_utils import before_validator_handler
|
39
40
|
from zenml.zen_stores.secrets_stores.base_secrets_store import (
|
40
41
|
BaseSecretsStore,
|
41
42
|
)
|
@@ -54,12 +55,14 @@ class ServiceConnectorSecretsStoreConfiguration(SecretsStoreConfiguration):
|
|
54
55
|
auth_method: str
|
55
56
|
auth_config: Dict[str, Any] = Field(default_factory=dict)
|
56
57
|
|
57
|
-
@
|
58
|
-
|
58
|
+
@model_validator(mode="before")
|
59
|
+
@classmethod
|
60
|
+
@before_validator_handler
|
61
|
+
def validate_auth_config(cls, data: Dict[str, Any]) -> Dict[str, Any]:
|
59
62
|
"""Convert the authentication configuration if given in JSON format.
|
60
63
|
|
61
64
|
Args:
|
62
|
-
|
65
|
+
data: The configuration values.
|
63
66
|
|
64
67
|
Returns:
|
65
68
|
The validated configuration values.
|
@@ -68,15 +71,15 @@ class ServiceConnectorSecretsStoreConfiguration(SecretsStoreConfiguration):
|
|
68
71
|
ValueError: If the authentication configuration is not a valid
|
69
72
|
JSON object.
|
70
73
|
"""
|
71
|
-
if isinstance(
|
74
|
+
if isinstance(data.get("auth_config"), str):
|
72
75
|
try:
|
73
|
-
|
76
|
+
data["auth_config"] = json.loads(data["auth_config"])
|
74
77
|
except json.JSONDecodeError as e:
|
75
78
|
raise ValueError(
|
76
79
|
f"The authentication configuration is not a valid JSON "
|
77
80
|
f"object: {e}"
|
78
81
|
)
|
79
|
-
return
|
82
|
+
return data
|
80
83
|
|
81
84
|
|
82
85
|
class ServiceConnectorSecretsStore(BaseSecretsStore):
|
@@ -23,6 +23,7 @@ from typing import (
|
|
23
23
|
)
|
24
24
|
from uuid import UUID
|
25
25
|
|
26
|
+
from pydantic import ConfigDict
|
26
27
|
from sqlalchemy.engine import Engine
|
27
28
|
from sqlalchemy.exc import NoResultFound
|
28
29
|
from sqlalchemy_utils.types.encrypted.encrypted_type import AesGcmEngine
|
@@ -62,16 +63,14 @@ class SqlSecretsStoreConfiguration(SecretsStoreConfiguration):
|
|
62
63
|
|
63
64
|
type: SecretsStoreType = SecretsStoreType.SQL
|
64
65
|
encryption_key: Optional[str] = None
|
65
|
-
|
66
|
-
class Config:
|
67
|
-
"""Pydantic configuration class."""
|
68
|
-
|
66
|
+
model_config = ConfigDict(
|
69
67
|
# Don't validate attributes when assigning them. This is necessary
|
70
68
|
# because the certificate attributes can be expanded to the contents
|
71
69
|
# of the certificate files.
|
72
|
-
validate_assignment
|
70
|
+
validate_assignment=False,
|
73
71
|
# Forbid extra attributes set in the class.
|
74
|
-
extra
|
72
|
+
extra="forbid",
|
73
|
+
)
|
75
74
|
|
76
75
|
|
77
76
|
class SqlSecretsStore(BaseSecretsStore):
|