zenml-nightly 0.58.2.dev20240618__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/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 -10
- 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/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 +1 -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/evidently/__init__.py +3 -4
- 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/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/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/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/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/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_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/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/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.dev20240618.dist-info → zenml_nightly-0.58.2.dev20240619.dist-info}/METADATA +8 -7
- {zenml_nightly-0.58.2.dev20240618.dist-info → zenml_nightly-0.58.2.dev20240619.dist-info}/RECORD +297 -294
- 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.dev20240618.dist-info → zenml_nightly-0.58.2.dev20240619.dist-info}/LICENSE +0 -0
- {zenml_nightly-0.58.2.dev20240618.dist-info → zenml_nightly-0.58.2.dev20240619.dist-info}/WHEEL +0 -0
- {zenml_nightly-0.58.2.dev20240618.dist-info → zenml_nightly-0.58.2.dev20240619.dist-info}/entry_points.txt +0 -0
@@ -28,8 +28,6 @@ from typing import (
|
|
28
28
|
)
|
29
29
|
from uuid import UUID
|
30
30
|
|
31
|
-
from pydantic.typing import get_origin, is_union
|
32
|
-
|
33
31
|
from zenml.artifacts.unmaterialized_artifact import UnmaterializedArtifact
|
34
32
|
from zenml.artifacts.utils import save_artifact
|
35
33
|
from zenml.config.step_configurations import StepConfiguration
|
@@ -63,6 +61,7 @@ from zenml.steps.utils import (
|
|
63
61
|
resolve_type_annotation,
|
64
62
|
)
|
65
63
|
from zenml.utils import materializer_utils, source_utils
|
64
|
+
from zenml.utils.typing_utils import get_origin, is_union
|
66
65
|
|
67
66
|
if TYPE_CHECKING:
|
68
67
|
from zenml.config.source import Source
|
@@ -396,7 +395,7 @@ class StepRunner:
|
|
396
395
|
|
397
396
|
# Parse the parameters
|
398
397
|
if issubclass(arg_type, BaseParameters):
|
399
|
-
step_params = arg_type.
|
398
|
+
step_params = arg_type.model_validate(
|
400
399
|
self.configuration.parameters[arg]
|
401
400
|
)
|
402
401
|
function_params[arg] = step_params
|
@@ -440,7 +439,7 @@ class StepRunner:
|
|
440
439
|
# Skip materialization for `UnmaterializedArtifact`.
|
441
440
|
if data_type == UnmaterializedArtifact:
|
442
441
|
return UnmaterializedArtifact(
|
443
|
-
**artifact.get_hydrated_version().
|
442
|
+
**artifact.get_hydrated_version().model_dump()
|
444
443
|
)
|
445
444
|
|
446
445
|
if data_type is Any or is_union(get_origin(data_type)):
|
@@ -513,8 +512,6 @@ class StepRunner:
|
|
513
512
|
f"(return values: {return_values})."
|
514
513
|
)
|
515
514
|
|
516
|
-
from pydantic.typing import get_origin, is_union
|
517
|
-
|
518
515
|
from zenml.steps.utils import get_args
|
519
516
|
|
520
517
|
validated_outputs: Dict[str, Any] = {}
|
zenml/orchestrators/utils.py
CHANGED
@@ -225,7 +225,7 @@ def _link_cached_artifacts_to_model(
|
|
225
225
|
if output_name_ in output_annotations:
|
226
226
|
annotation = output_annotations.get(output_name_, None)
|
227
227
|
if annotation and annotation.artifact_config is not None:
|
228
|
-
artifact_config_ = annotation.artifact_config.
|
228
|
+
artifact_config_ = annotation.artifact_config.model_copy()
|
229
229
|
# no artifact config found or artifact was produced by `save_artifact`
|
230
230
|
# inside the step body, so was never in annotations
|
231
231
|
if artifact_config_ is None:
|
@@ -16,7 +16,7 @@
|
|
16
16
|
from abc import ABC, abstractmethod
|
17
17
|
from typing import TYPE_CHECKING, Any, ClassVar, Type
|
18
18
|
|
19
|
-
from pydantic import BaseModel,
|
19
|
+
from pydantic import BaseModel, ConfigDict
|
20
20
|
|
21
21
|
from zenml.config.global_config import GlobalConfiguration
|
22
22
|
from zenml.enums import PluginSubType, PluginType
|
@@ -29,16 +29,12 @@ if TYPE_CHECKING:
|
|
29
29
|
class BasePluginConfig(BaseModel, ABC):
|
30
30
|
"""Allows configuring of Event Source and Filter configuration."""
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
# public attributes are immutable
|
36
|
-
allow_mutation = True
|
37
|
-
# all attributes with leading underscore are private and therefore
|
38
|
-
# are mutable and not included in serialization
|
39
|
-
underscore_attrs_are_private = True
|
32
|
+
model_config = ConfigDict(
|
33
|
+
# public attributes are mutable
|
34
|
+
frozen=False,
|
40
35
|
# ignore extra attributes during model initialization
|
41
|
-
extra
|
36
|
+
extra="ignore",
|
37
|
+
)
|
42
38
|
|
43
39
|
|
44
40
|
class BasePlugin(ABC):
|
@@ -16,7 +16,7 @@
|
|
16
16
|
import math
|
17
17
|
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, Type
|
18
18
|
|
19
|
-
from pydantic import BaseModel
|
19
|
+
from pydantic import BaseModel, ConfigDict
|
20
20
|
|
21
21
|
from zenml.enums import PluginSubType, PluginType
|
22
22
|
from zenml.integrations.registry import integration_registry
|
@@ -35,12 +35,8 @@ class RegistryEntry(BaseModel):
|
|
35
35
|
"""Registry Entry Class for the Plugin Registry."""
|
36
36
|
|
37
37
|
flavor_class: Type[BasePluginFlavor]
|
38
|
-
plugin_instance: Optional[BasePlugin]
|
39
|
-
|
40
|
-
class Config:
|
41
|
-
"""Pydantic configuration class."""
|
42
|
-
|
43
|
-
arbitrary_types_allowed = True
|
38
|
+
plugin_instance: Optional[BasePlugin] = None
|
39
|
+
model_config = ConfigDict(arbitrary_types_allowed=True)
|
44
40
|
|
45
41
|
|
46
42
|
class PluginFlavorRegistry:
|
zenml/secret/base_secret.py
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
|
16
16
|
from typing import Any, Dict, List
|
17
17
|
|
18
|
-
from pydantic import BaseModel
|
18
|
+
from pydantic import BaseModel, ConfigDict
|
19
19
|
|
20
20
|
|
21
21
|
class BaseSecretSchema(BaseModel):
|
@@ -31,7 +31,7 @@ class BaseSecretSchema(BaseModel):
|
|
31
31
|
Returns:
|
32
32
|
A list of all attribute names that are part of the schema.
|
33
33
|
"""
|
34
|
-
return list(cls.
|
34
|
+
return list(cls.model_fields.keys())
|
35
35
|
|
36
36
|
def get_values(self) -> Dict[str, Any]:
|
37
37
|
"""Get all values of the secret schema.
|
@@ -39,12 +39,11 @@ class BaseSecretSchema(BaseModel):
|
|
39
39
|
Returns:
|
40
40
|
A dictionary of all attribute names and their corresponding values.
|
41
41
|
"""
|
42
|
-
return self.
|
43
|
-
|
44
|
-
class Config:
|
45
|
-
"""Pydantic configuration class."""
|
42
|
+
return self.model_dump(exclude_none=True)
|
46
43
|
|
44
|
+
model_config = ConfigDict(
|
47
45
|
# validate attribute assignments
|
48
|
-
validate_assignment
|
46
|
+
validate_assignment=True,
|
49
47
|
# report extra attributes as validation failures
|
50
|
-
extra
|
48
|
+
extra="forbid",
|
49
|
+
)
|
@@ -23,7 +23,7 @@ from typing import Any, List, Optional
|
|
23
23
|
|
24
24
|
from docker.client import DockerClient
|
25
25
|
from docker.errors import DockerException
|
26
|
-
from pydantic import Field
|
26
|
+
from pydantic import Field
|
27
27
|
|
28
28
|
from zenml.constants import DOCKER_REGISTRY_RESOURCE_TYPE
|
29
29
|
from zenml.exceptions import AuthorizationException
|
@@ -39,6 +39,7 @@ from zenml.service_connectors.service_connector import (
|
|
39
39
|
)
|
40
40
|
from zenml.utils import docker_utils
|
41
41
|
from zenml.utils.enum_utils import StrEnum
|
42
|
+
from zenml.utils.secret_utils import PlainSerializedSecretStr
|
42
43
|
|
43
44
|
logger = get_logger(__name__)
|
44
45
|
|
@@ -46,10 +47,10 @@ logger = get_logger(__name__)
|
|
46
47
|
class DockerCredentials(AuthenticationConfig):
|
47
48
|
"""Docker client authentication credentials."""
|
48
49
|
|
49
|
-
username:
|
50
|
+
username: PlainSerializedSecretStr = Field(
|
50
51
|
title="Username",
|
51
52
|
)
|
52
|
-
password:
|
53
|
+
password: PlainSerializedSecretStr = Field(
|
53
54
|
title="Password",
|
54
55
|
)
|
55
56
|
|
@@ -34,7 +34,7 @@ from pydantic import (
|
|
34
34
|
SecretStr,
|
35
35
|
ValidationError,
|
36
36
|
)
|
37
|
-
from pydantic.
|
37
|
+
from pydantic._internal._model_construction import ModelMetaclass
|
38
38
|
|
39
39
|
from zenml.client import Client
|
40
40
|
from zenml.constants import (
|
@@ -71,7 +71,7 @@ class AuthenticationConfig(BaseModel):
|
|
71
71
|
"""
|
72
72
|
return {
|
73
73
|
k: v
|
74
|
-
for k, v in self.
|
74
|
+
for k, v in self.model_dump(exclude_none=True).items()
|
75
75
|
if isinstance(v, SecretStr)
|
76
76
|
}
|
77
77
|
|
@@ -84,7 +84,7 @@ class AuthenticationConfig(BaseModel):
|
|
84
84
|
"""
|
85
85
|
return {
|
86
86
|
k: v
|
87
|
-
for k, v in self.
|
87
|
+
for k, v in self.model_dump(exclude_none=True).items()
|
88
88
|
if not isinstance(v, SecretStr)
|
89
89
|
}
|
90
90
|
|
@@ -95,7 +95,7 @@ class AuthenticationConfig(BaseModel):
|
|
95
95
|
Returns:
|
96
96
|
A dictionary of all values in the configuration.
|
97
97
|
"""
|
98
|
-
return self.
|
98
|
+
return self.model_dump(exclude_none=True)
|
99
99
|
|
100
100
|
|
101
101
|
class ServiceConnectorMeta(ModelMetaclass):
|
@@ -487,7 +487,7 @@ class ServiceConnector(BaseModel, metaclass=ServiceConnectorMeta):
|
|
487
487
|
):
|
488
488
|
return self
|
489
489
|
|
490
|
-
copy = self.
|
490
|
+
copy = self.model_copy()
|
491
491
|
copy.resource_type = resource_type
|
492
492
|
copy.resource_id = resource_id
|
493
493
|
return copy
|
@@ -1401,10 +1401,3 @@ class ServiceConnector(BaseModel, metaclass=ServiceConnectorMeta):
|
|
1401
1401
|
)
|
1402
1402
|
|
1403
1403
|
return connector_client
|
1404
|
-
|
1405
|
-
class Config:
|
1406
|
-
"""Connector configuration."""
|
1407
|
-
|
1408
|
-
# all attributes with leading underscore are private and therefore
|
1409
|
-
# are mutable and not included in serialization
|
1410
|
-
underscore_attrs_are_private = True
|
@@ -22,7 +22,6 @@ if TYPE_CHECKING:
|
|
22
22
|
from zenml.models import (
|
23
23
|
ServiceConnectorRequest,
|
24
24
|
ServiceConnectorResponse,
|
25
|
-
ServiceConnectorUpdate,
|
26
25
|
)
|
27
26
|
from zenml.service_connectors.service_connector import ServiceConnector
|
28
27
|
logger = get_logger(__name__)
|
@@ -90,7 +89,7 @@ class ServiceConnectorRegistry:
|
|
90
89
|
f"Please make sure the corresponding packages and/or ZenML "
|
91
90
|
f"integration are installed and try again."
|
92
91
|
)
|
93
|
-
return self.service_connector_types[connector_type].
|
92
|
+
return self.service_connector_types[connector_type].model_copy()
|
94
93
|
|
95
94
|
def __getitem__(self, key: str) -> ServiceConnectorTypeModel:
|
96
95
|
"""Get a service connector type by its connector type identifier.
|
@@ -155,7 +154,7 @@ class ServiceConnectorRegistry:
|
|
155
154
|
or auth_method in service_connector_type.auth_method_dict
|
156
155
|
)
|
157
156
|
):
|
158
|
-
matches.append(service_connector_type.
|
157
|
+
matches.append(service_connector_type.model_copy())
|
159
158
|
|
160
159
|
return matches
|
161
160
|
|
@@ -164,7 +163,6 @@ class ServiceConnectorRegistry:
|
|
164
163
|
model: Union[
|
165
164
|
"ServiceConnectorRequest",
|
166
165
|
"ServiceConnectorResponse",
|
167
|
-
"ServiceConnectorUpdate",
|
168
166
|
],
|
169
167
|
) -> "ServiceConnector":
|
170
168
|
"""Validate a service connector model and create an instance from it.
|
@@ -289,7 +289,7 @@ class ContainerService(BaseService):
|
|
289
289
|
assert self.status.log_file is not None
|
290
290
|
|
291
291
|
with open(self.status.config_file, "w") as f:
|
292
|
-
f.write(self.
|
292
|
+
f.write(self.model_dump_json(indent=4))
|
293
293
|
pathlib.Path(self.status.log_file).touch()
|
294
294
|
|
295
295
|
command = [
|
@@ -80,7 +80,7 @@ class ContainerServiceEndpoint(BaseServiceEndpoint):
|
|
80
80
|
)
|
81
81
|
monitor: Optional[
|
82
82
|
Union[HTTPEndpointHealthMonitor, TCPEndpointHealthMonitor]
|
83
|
-
] = Field(..., discriminator="type")
|
83
|
+
] = Field(..., discriminator="type", union_mode="left_to_right")
|
84
84
|
|
85
85
|
def _lookup_free_port(self) -> int:
|
86
86
|
"""Search for a free TCP port for the service endpoint.
|
@@ -331,7 +331,7 @@ class LocalDaemonService(BaseService):
|
|
331
331
|
assert self.status.pid_file is not None
|
332
332
|
|
333
333
|
with open(self.status.config_file, "w") as f:
|
334
|
-
f.write(self.
|
334
|
+
f.write(self.model_dump_json(indent=4))
|
335
335
|
|
336
336
|
# delete the previous PID file, in case a previous daemon process
|
337
337
|
# crashed and left a stale PID file
|
@@ -83,7 +83,7 @@ class LocalDaemonServiceEndpoint(BaseServiceEndpoint):
|
|
83
83
|
)
|
84
84
|
monitor: Optional[
|
85
85
|
Union[HTTPEndpointHealthMonitor, TCPEndpointHealthMonitor]
|
86
|
-
] = Field(..., discriminator="type")
|
86
|
+
] = Field(..., discriminator="type", union_mode="left_to_right")
|
87
87
|
|
88
88
|
def _lookup_free_port(self) -> int:
|
89
89
|
"""Search for a free TCP port for the service endpoint.
|
zenml/services/service.py
CHANGED
@@ -31,6 +31,8 @@ from typing import (
|
|
31
31
|
)
|
32
32
|
from uuid import UUID
|
33
33
|
|
34
|
+
from pydantic import ConfigDict
|
35
|
+
|
34
36
|
from zenml.console import console
|
35
37
|
from zenml.logger import get_logger
|
36
38
|
from zenml.services.service_endpoint import BaseServiceEndpoint
|
@@ -117,6 +119,14 @@ class ServiceConfig(BaseTypedModel):
|
|
117
119
|
model_version: str = ""
|
118
120
|
service_name: str = ""
|
119
121
|
|
122
|
+
# TODO: In Pydantic v2, the `model_` is a protected namespaces for all
|
123
|
+
# fields defined under base models. If not handled, this raises a warning.
|
124
|
+
# It is possible to suppress this warning message with the following
|
125
|
+
# configuration, however the ultimate solution is to rename these fields.
|
126
|
+
# Even though they do not cause any problems right now, if we are not
|
127
|
+
# careful we might overwrite some fields protected by pydantic.
|
128
|
+
model_config = ConfigDict(protected_namespaces=())
|
129
|
+
|
120
130
|
def __init__(self, **data: Any):
|
121
131
|
"""Initialize the service configuration.
|
122
132
|
|
@@ -142,7 +152,7 @@ class ServiceConfig(BaseTypedModel):
|
|
142
152
|
a dictionary of service labels.
|
143
153
|
"""
|
144
154
|
labels = {}
|
145
|
-
for k, v in self.
|
155
|
+
for k, v in self.model_dump().items():
|
146
156
|
label = f"zenml_{k}".upper()
|
147
157
|
labels[label] = str(v)
|
148
158
|
return labels
|
@@ -172,7 +182,7 @@ class BaseService(BaseTypedModel):
|
|
172
182
|
config: ServiceConfig
|
173
183
|
status: ServiceStatus
|
174
184
|
# TODO [ENG-703]: allow multiple endpoints per service
|
175
|
-
endpoint: Optional[BaseServiceEndpoint]
|
185
|
+
endpoint: Optional[BaseServiceEndpoint] = None
|
176
186
|
|
177
187
|
def __init__(
|
178
188
|
self,
|
@@ -209,7 +219,7 @@ class BaseService(BaseTypedModel):
|
|
209
219
|
admin_state=model.admin_state,
|
210
220
|
config=model.config,
|
211
221
|
status=model.status,
|
212
|
-
service_type=model.service_type.
|
222
|
+
service_type=model.service_type.model_dump(),
|
213
223
|
endpoint=model.endpoint,
|
214
224
|
)
|
215
225
|
|
@@ -512,14 +522,10 @@ class BaseService(BaseTypedModel):
|
|
512
522
|
"""
|
513
523
|
return self.__repr__()
|
514
524
|
|
515
|
-
|
516
|
-
"""Pydantic configuration class."""
|
517
|
-
|
525
|
+
model_config = ConfigDict(
|
518
526
|
# validate attribute assignments
|
519
|
-
validate_assignment
|
520
|
-
|
521
|
-
# are mutable and not included in serialization
|
522
|
-
underscore_attrs_are_private = True
|
527
|
+
validate_assignment=True,
|
528
|
+
)
|
523
529
|
|
524
530
|
|
525
531
|
class BaseDeploymentService(BaseService):
|
zenml/services/service_type.py
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
# permissions and limitations under the License.
|
14
14
|
"""Implementation of a ZenML ServiceType class."""
|
15
15
|
|
16
|
-
from pydantic import BaseModel
|
16
|
+
from pydantic import BaseModel, ConfigDict
|
17
17
|
|
18
18
|
|
19
19
|
class ServiceType(BaseModel):
|
@@ -33,8 +33,7 @@ class ServiceType(BaseModel):
|
|
33
33
|
description: str = ""
|
34
34
|
logo_url: str = ""
|
35
35
|
|
36
|
-
|
37
|
-
"""Pydantic configuration class."""
|
38
|
-
|
36
|
+
model_config = ConfigDict(
|
39
37
|
# make the service type immutable and hashable
|
40
|
-
frozen
|
38
|
+
frozen=True
|
39
|
+
)
|
@@ -176,7 +176,7 @@ class TerraformService(BaseService):
|
|
176
176
|
assert self.status.config_file is not None
|
177
177
|
|
178
178
|
with open(self.status.config_file, "w") as f:
|
179
|
-
f.write(self.
|
179
|
+
f.write(self.model_dump_json(indent=4))
|
180
180
|
|
181
181
|
def _write_vars_to_file(self, vars: Dict[str, Any]) -> None:
|
182
182
|
"""Write variables to the variables file.
|
zenml/stack/flavor.py
CHANGED
@@ -13,7 +13,6 @@
|
|
13
13
|
# permissions and limitations under the License.
|
14
14
|
"""Base ZenML Flavor implementation."""
|
15
15
|
|
16
|
-
import json
|
17
16
|
from abc import abstractmethod
|
18
17
|
from typing import Any, Dict, Optional, Type, cast
|
19
18
|
|
@@ -102,10 +101,7 @@ class Flavor:
|
|
102
101
|
Returns:
|
103
102
|
The config schema.
|
104
103
|
"""
|
105
|
-
|
106
|
-
self.config_class.schema_json()
|
107
|
-
)
|
108
|
-
return config_schema
|
104
|
+
return self.config_class.model_json_schema()
|
109
105
|
|
110
106
|
@property
|
111
107
|
def service_connector_requirements(
|
zenml/stack/flavor_registry.py
CHANGED
@@ -122,8 +122,8 @@ class FlavorRegistry:
|
|
122
122
|
if len(existing_flavor) == 0:
|
123
123
|
store.create_flavor(flavor_request_model)
|
124
124
|
else:
|
125
|
-
flavor_update_model = FlavorUpdate.
|
126
|
-
flavor_request_model
|
125
|
+
flavor_update_model = FlavorUpdate.model_validate(
|
126
|
+
dict(flavor_request_model)
|
127
127
|
)
|
128
128
|
store.update_flavor(
|
129
129
|
existing_flavor[0].id, flavor_update_model
|
@@ -154,8 +154,8 @@ class FlavorRegistry:
|
|
154
154
|
if len(existing_flavor) == 0:
|
155
155
|
store.create_flavor(flavor_request_model)
|
156
156
|
else:
|
157
|
-
flavor_update_model = FlavorUpdate.
|
158
|
-
flavor_request_model
|
157
|
+
flavor_update_model = FlavorUpdate.model_validate(
|
158
|
+
dict(flavor_request_model)
|
159
159
|
)
|
160
160
|
store.update_flavor(
|
161
161
|
existing_flavor[0].id, flavor_update_model
|
zenml/stack/stack.py
CHANGED
@@ -15,6 +15,7 @@
|
|
15
15
|
|
16
16
|
import functools
|
17
17
|
import itertools
|
18
|
+
import json
|
18
19
|
import os
|
19
20
|
from datetime import datetime
|
20
21
|
from typing import (
|
@@ -481,7 +482,9 @@ class Stack:
|
|
481
482
|
A dictionary containing the stack components.
|
482
483
|
"""
|
483
484
|
component_dict = {
|
484
|
-
component_type.value:
|
485
|
+
component_type.value: json.dumps(
|
486
|
+
component.config.model_dump(mode="json"), sort_keys=True
|
487
|
+
)
|
485
488
|
for component_type, component in self.components.items()
|
486
489
|
}
|
487
490
|
component_dict.update({"name": self.name})
|
zenml/stack/stack_component.py
CHANGED
@@ -21,8 +21,7 @@ from inspect import isclass
|
|
21
21
|
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Type, Union
|
22
22
|
from uuid import UUID
|
23
23
|
|
24
|
-
from pydantic import BaseModel,
|
25
|
-
from pydantic.typing import get_origin
|
24
|
+
from pydantic import BaseModel, ConfigDict, model_validator
|
26
25
|
|
27
26
|
from zenml.config.build_configuration import BuildConfiguration
|
28
27
|
from zenml.config.step_configurations import Step
|
@@ -31,7 +30,12 @@ from zenml.enums import StackComponentType
|
|
31
30
|
from zenml.exceptions import AuthorizationException
|
32
31
|
from zenml.logger import get_logger
|
33
32
|
from zenml.models import ServiceConnectorRequirements, StepRunResponse
|
34
|
-
from zenml.utils import
|
33
|
+
from zenml.utils import (
|
34
|
+
pydantic_utils,
|
35
|
+
secret_utils,
|
36
|
+
settings_utils,
|
37
|
+
typing_utils,
|
38
|
+
)
|
35
39
|
|
36
40
|
if TYPE_CHECKING:
|
37
41
|
from zenml.config.base_settings import BaseSettings
|
@@ -65,7 +69,8 @@ class StackComponentConfig(BaseModel, ABC):
|
|
65
69
|
custom pydantic validation are set as secret references.
|
66
70
|
|
67
71
|
Args:
|
68
|
-
warn_about_plain_text_secrets: If true, then warns about using
|
72
|
+
warn_about_plain_text_secrets: If true, then warns about using
|
73
|
+
plain-text secrets.
|
69
74
|
**kwargs: Arguments to initialize this stack component.
|
70
75
|
|
71
76
|
Raises:
|
@@ -75,7 +80,7 @@ class StackComponentConfig(BaseModel, ABC):
|
|
75
80
|
"""
|
76
81
|
for key, value in kwargs.items():
|
77
82
|
try:
|
78
|
-
field = self.__class__.
|
83
|
+
field = self.__class__.model_fields[key]
|
79
84
|
except KeyError:
|
80
85
|
# Value for a private attribute or non-existing field, this
|
81
86
|
# will fail during the upcoming pydantic validation
|
@@ -101,8 +106,9 @@ class StackComponentConfig(BaseModel, ABC):
|
|
101
106
|
)
|
102
107
|
continue
|
103
108
|
|
104
|
-
|
105
|
-
|
109
|
+
if pydantic_utils.has_validators(
|
110
|
+
pydantic_class=self.__class__, field_name=key
|
111
|
+
):
|
106
112
|
raise ValueError(
|
107
113
|
f"Passing the stack component attribute `{key}` as a "
|
108
114
|
"secret reference is not allowed as additional validation "
|
@@ -120,7 +126,7 @@ class StackComponentConfig(BaseModel, ABC):
|
|
120
126
|
"""
|
121
127
|
return {
|
122
128
|
secret_utils.parse_secret_reference(v)
|
123
|
-
for v in self.
|
129
|
+
for v in self.model_dump().values()
|
124
130
|
if secret_utils.is_secret_reference(v)
|
125
131
|
}
|
126
132
|
|
@@ -246,52 +252,70 @@ class StackComponentConfig(BaseModel, ABC):
|
|
246
252
|
# (see https://github.com/python/mypy/issues/13319).
|
247
253
|
__getattribute__ = __custom_getattribute__
|
248
254
|
|
249
|
-
@
|
250
|
-
|
255
|
+
@model_validator(mode="before")
|
256
|
+
@classmethod
|
257
|
+
@pydantic_utils.before_validator_handler
|
258
|
+
def _convert_json_strings(cls, data: Dict[str, Any]) -> Dict[str, Any]:
|
251
259
|
"""Converts potential JSON strings.
|
252
260
|
|
253
261
|
Args:
|
254
|
-
|
262
|
+
data: The model data.
|
255
263
|
|
256
264
|
Returns:
|
257
|
-
The potentially converted
|
265
|
+
The potentially converted data.
|
258
266
|
|
259
267
|
Raises:
|
260
268
|
ValueError: If any of the values is an invalid JSON string.
|
261
269
|
"""
|
262
|
-
for key, field in cls.
|
263
|
-
|
270
|
+
for key, field in cls.model_fields.items():
|
271
|
+
if not field.annotation:
|
272
|
+
continue
|
273
|
+
|
274
|
+
value = data.get(key, None)
|
264
275
|
|
265
276
|
if isinstance(value, str):
|
266
|
-
if
|
277
|
+
if typing_utils.is_optional(field.annotation):
|
278
|
+
args = list(typing_utils.get_args(field.annotation))
|
279
|
+
if str in args:
|
280
|
+
# Don't do any type coercion in case str is in the
|
281
|
+
# possible types of the field
|
282
|
+
continue
|
283
|
+
|
284
|
+
# Remove `NoneType` from the arguments
|
285
|
+
NoneType = type(None)
|
286
|
+
if NoneType in args:
|
287
|
+
args.remove(NoneType)
|
288
|
+
|
289
|
+
# We just choose the first arg and match against this
|
290
|
+
annotation = args[0]
|
291
|
+
else:
|
292
|
+
annotation = field.annotation
|
293
|
+
|
294
|
+
if typing_utils.get_origin(annotation) in {
|
267
295
|
dict,
|
268
296
|
list,
|
269
297
|
Mapping,
|
270
298
|
Sequence,
|
271
299
|
}:
|
272
300
|
try:
|
273
|
-
|
301
|
+
data[key] = json.loads(value)
|
274
302
|
except json.JSONDecodeError as e:
|
275
303
|
raise ValueError(
|
276
304
|
f"Invalid json string '{value}'"
|
277
305
|
) from e
|
278
|
-
elif isclass(
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
return values
|
306
|
+
elif isclass(annotation) and issubclass(annotation, BaseModel):
|
307
|
+
data[key] = annotation.model_validate_json(
|
308
|
+
value
|
309
|
+
).model_dump()
|
284
310
|
|
285
|
-
|
286
|
-
"""Pydantic configuration class."""
|
311
|
+
return data
|
287
312
|
|
313
|
+
model_config = ConfigDict(
|
288
314
|
# public attributes are immutable
|
289
|
-
|
290
|
-
# all attributes with leading underscore are private and therefore
|
291
|
-
# are mutable and not included in serialization
|
292
|
-
underscore_attrs_are_private = True
|
315
|
+
frozen=True,
|
293
316
|
# prevent extra attributes during model initialization
|
294
|
-
extra
|
317
|
+
extra="forbid",
|
318
|
+
)
|
295
319
|
|
296
320
|
|
297
321
|
class StackComponent:
|
@@ -480,7 +504,7 @@ class StackComponent:
|
|
480
504
|
)
|
481
505
|
|
482
506
|
if key in all_settings:
|
483
|
-
return self.settings_class.
|
507
|
+
return self.settings_class.model_validate(dict(all_settings[key]))
|
484
508
|
else:
|
485
509
|
return self.settings_class()
|
486
510
|
|
@@ -810,7 +834,7 @@ class StackComponent:
|
|
810
834
|
A string representation of the stack component.
|
811
835
|
"""
|
812
836
|
attribute_representation = ", ".join(
|
813
|
-
f"{key}={value}" for key, value in self.config.
|
837
|
+
f"{key}={value}" for key, value in self.config.model_dump().items()
|
814
838
|
)
|
815
839
|
return (
|
816
840
|
f"{self.__class__.__qualname__}(type={self.type}, "
|