From c20fb7c0828aac4a4704a5f3cc9fd4f1f78e0302 Mon Sep 17 00:00:00 2001 From: Bruno Dufour Date: Wed, 27 Nov 2024 10:09:40 -0500 Subject: [PATCH] Move PathMapping and ProcessorMapping out of native app logic (#1899) --- .../cli/_plugins/nativeapp/artifacts.py | 2 +- .../cli/_plugins/nativeapp/bundle_context.py | 2 +- .../nativeapp/codegen/artifact_processor.py | 2 +- .../_plugins/nativeapp/codegen/compiler.py | 4 +- .../setup/native_app_setup_processor.py | 2 +- .../codegen/snowpark/python_processor.py | 2 +- .../codegen/templates/templates_processor.py | 2 +- .../nativeapp/entities/application_package.py | 28 +------ .../cli/_plugins/snowpark/commands.py | 2 +- .../snowpark/snowpark_entity_model.py | 4 +- .../snowpark/snowpark_project_paths.py | 2 +- .../cli/_plugins/streamlit/manager.py | 2 +- .../streamlit/streamlit_entity_model.py | 4 +- src/snowflake/cli/api/artifacts/bundle_map.py | 2 +- .../cli/api/project/schemas/commons.py | 5 -- .../api/project/schemas/entities/common.py | 75 ++++++++++++++++++- .../schemas/v1/native_app/native_app.py | 3 +- .../schemas/v1/native_app/path_mapping.py | 65 ---------------- tests/api/artifacts/test_bundle_map.py | 2 +- .../helpers/__snapshots__/test_v1_to_v2.ambr | 8 +- .../codegen/snowpark/test_python_processor.py | 4 +- .../templating/test_templates_processor.py | 2 +- .../test_annotation_processor_config.py | 4 +- tests/nativeapp/test_artifacts.py | 2 +- tests/project/test_config.py | 2 +- tests/project/test_project_definition_v2.py | 2 +- 26 files changed, 103 insertions(+), 131 deletions(-) delete mode 100644 src/snowflake/cli/api/project/schemas/commons.py delete mode 100644 src/snowflake/cli/api/project/schemas/v1/native_app/path_mapping.py diff --git a/src/snowflake/cli/_plugins/nativeapp/artifacts.py b/src/snowflake/cli/_plugins/nativeapp/artifacts.py index 22a1bc1e9f..27fb3d820e 100644 --- a/src/snowflake/cli/_plugins/nativeapp/artifacts.py +++ b/src/snowflake/cli/_plugins/nativeapp/artifacts.py @@ -25,7 +25,7 @@ from snowflake.cli.api.artifacts.utils import symlink_or_copy from snowflake.cli.api.cli_global_context import span from snowflake.cli.api.constants import DEFAULT_SIZE_LIMIT_MB -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import PathMapping +from snowflake.cli.api.project.schemas.entities.common import PathMapping from snowflake.cli.api.project.util import to_identifier from snowflake.cli.api.secure_path import SecurePath from snowflake.cli.api.utils.path_utils import delete diff --git a/src/snowflake/cli/_plugins/nativeapp/bundle_context.py b/src/snowflake/cli/_plugins/nativeapp/bundle_context.py index a8e6427eda..a680ff8779 100644 --- a/src/snowflake/cli/_plugins/nativeapp/bundle_context.py +++ b/src/snowflake/cli/_plugins/nativeapp/bundle_context.py @@ -18,7 +18,7 @@ List, ) -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import PathMapping +from snowflake.cli.api.project.schemas.entities.common import PathMapping @dataclass diff --git a/src/snowflake/cli/_plugins/nativeapp/codegen/artifact_processor.py b/src/snowflake/cli/_plugins/nativeapp/codegen/artifact_processor.py index 922fdc55ab..02dc4ff11a 100644 --- a/src/snowflake/cli/_plugins/nativeapp/codegen/artifact_processor.py +++ b/src/snowflake/cli/_plugins/nativeapp/codegen/artifact_processor.py @@ -20,7 +20,7 @@ from click import ClickException from snowflake.cli._plugins.nativeapp.bundle_context import BundleContext -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import ( +from snowflake.cli.api.project.schemas.entities.common import ( PathMapping, ProcessorMapping, ) diff --git a/src/snowflake/cli/_plugins/nativeapp/codegen/compiler.py b/src/snowflake/cli/_plugins/nativeapp/codegen/compiler.py index 07302e6356..643f425888 100644 --- a/src/snowflake/cli/_plugins/nativeapp/codegen/compiler.py +++ b/src/snowflake/cli/_plugins/nativeapp/codegen/compiler.py @@ -37,9 +37,7 @@ from snowflake.cli.api.cli_global_context import get_cli_context from snowflake.cli.api.console import cli_console as cc from snowflake.cli.api.metrics import CLICounterField -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import ( - ProcessorMapping, -) +from snowflake.cli.api.project.schemas.entities.common import ProcessorMapping SNOWPARK_PROCESSOR = "snowpark" NA_SETUP_PROCESSOR = "native app setup" diff --git a/src/snowflake/cli/_plugins/nativeapp/codegen/setup/native_app_setup_processor.py b/src/snowflake/cli/_plugins/nativeapp/codegen/setup/native_app_setup_processor.py index 8ebdbb1e63..72a5676dd5 100644 --- a/src/snowflake/cli/_plugins/nativeapp/codegen/setup/native_app_setup_processor.py +++ b/src/snowflake/cli/_plugins/nativeapp/codegen/setup/native_app_setup_processor.py @@ -38,7 +38,7 @@ from snowflake.cli._plugins.stage.diff import to_stage_path from snowflake.cli.api.artifacts.bundle_map import BundleMap from snowflake.cli.api.console import cli_console as cc -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import ( +from snowflake.cli.api.project.schemas.entities.common import ( PathMapping, ProcessorMapping, ) diff --git a/src/snowflake/cli/_plugins/nativeapp/codegen/snowpark/python_processor.py b/src/snowflake/cli/_plugins/nativeapp/codegen/snowpark/python_processor.py index 293db0f6d9..e230fd7edc 100644 --- a/src/snowflake/cli/_plugins/nativeapp/codegen/snowpark/python_processor.py +++ b/src/snowflake/cli/_plugins/nativeapp/codegen/snowpark/python_processor.py @@ -51,7 +51,7 @@ from snowflake.cli.api.cli_global_context import get_cli_context, span from snowflake.cli.api.console import cli_console as cc from snowflake.cli.api.metrics import CLICounterField -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import ( +from snowflake.cli.api.project.schemas.entities.common import ( PathMapping, ProcessorMapping, ) diff --git a/src/snowflake/cli/_plugins/nativeapp/codegen/templates/templates_processor.py b/src/snowflake/cli/_plugins/nativeapp/codegen/templates/templates_processor.py index 6203b99d9a..fac348625c 100644 --- a/src/snowflake/cli/_plugins/nativeapp/codegen/templates/templates_processor.py +++ b/src/snowflake/cli/_plugins/nativeapp/codegen/templates/templates_processor.py @@ -26,7 +26,7 @@ from snowflake.cli.api.cli_global_context import get_cli_context, span from snowflake.cli.api.console import cli_console as cc from snowflake.cli.api.metrics import CLICounterField -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import ( +from snowflake.cli.api.project.schemas.entities.common import ( PathMapping, ProcessorMapping, ) diff --git a/src/snowflake/cli/_plugins/nativeapp/entities/application_package.py b/src/snowflake/cli/_plugins/nativeapp/entities/application_package.py index cdb1659f7d..34011ae4fb 100644 --- a/src/snowflake/cli/_plugins/nativeapp/entities/application_package.py +++ b/src/snowflake/cli/_plugins/nativeapp/entities/application_package.py @@ -64,9 +64,8 @@ ) from snowflake.cli.api.errno import DOES_NOT_EXIST_OR_NOT_AUTHORIZED from snowflake.cli.api.exceptions import SnowflakeSQLExecutionError -from snowflake.cli.api.project.schemas.commons import Artifacts from snowflake.cli.api.project.schemas.entities.common import ( - EntityModelBase, + ArtifactsBaseModel, Identifier, PostDeployHook, ) @@ -75,7 +74,6 @@ IdentifierField, ) from snowflake.cli.api.project.schemas.v1.native_app.package import DistributionOptions -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import PathMapping from snowflake.cli.api.project.util import ( SCHEMA_AND_NAME, append_test_resource_suffix, @@ -89,19 +87,12 @@ from snowflake.connector.cursor import SnowflakeCursor -class ApplicationPackageEntityModel(EntityModelBase): +class ApplicationPackageEntityModel(ArtifactsBaseModel): type: Literal["application package"] = DiscriminatorField() # noqa: A003 - artifacts: Artifacts = Field( - title="List of paths or file source/destination pairs to add to the deploy root", - ) bundle_root: Optional[str] = Field( title="Folder at the root of your project where artifacts necessary to perform the bundle step are stored.", default="output/bundle/", ) - deploy_root: Optional[str] = Field( - title="Folder at the root of your project where the build step copies the artifacts", - default="output/deploy/", - ) generated_root: Optional[str] = Field( title="Subdirectory of the deploy root where files generated by the Snowflake CLI will be written.", default="__generated/", @@ -136,21 +127,6 @@ def append_test_resource_suffix_to_identifier( return input_value.model_copy(update=dict(name=with_suffix)) return with_suffix - @field_validator("artifacts") - @classmethod - def transform_artifacts(cls, orig_artifacts: Artifacts) -> List[PathMapping]: - transformed_artifacts: List[PathMapping] = [] - if orig_artifacts is None: - return transformed_artifacts - - for artifact in orig_artifacts: - if isinstance(artifact, PathMapping): - transformed_artifacts.append(artifact) - else: - transformed_artifacts.append(PathMapping(src=artifact)) - - return transformed_artifacts - @field_validator("stage") @classmethod def validate_source_stage(cls, input_value: str): diff --git a/src/snowflake/cli/_plugins/snowpark/commands.py b/src/snowflake/cli/_plugins/snowpark/commands.py index 25e73eda2a..28db01d068 100644 --- a/src/snowflake/cli/_plugins/snowpark/commands.py +++ b/src/snowflake/cli/_plugins/snowpark/commands.py @@ -94,11 +94,11 @@ from snowflake.cli.api.project.definition_conversion import ( convert_project_definition_to_v2, ) +from snowflake.cli.api.project.schemas.entities.common import PathMapping from snowflake.cli.api.project.schemas.project_definition import ( ProjectDefinition, ProjectDefinitionV2, ) -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import PathMapping from snowflake.cli.api.secure_path import SecurePath from snowflake.connector import DictCursor, ProgrammingError from snowflake.connector.cursor import SnowflakeCursor diff --git a/src/snowflake/cli/_plugins/snowpark/snowpark_entity_model.py b/src/snowflake/cli/_plugins/snowpark/snowpark_entity_model.py index 5b355b804a..236742b7e4 100644 --- a/src/snowflake/cli/_plugins/snowpark/snowpark_entity_model.py +++ b/src/snowflake/cli/_plugins/snowpark/snowpark_entity_model.py @@ -20,16 +20,16 @@ from pydantic import Field, field_validator from snowflake.cli.api.feature_flags import FeatureFlag from snowflake.cli.api.identifiers import FQN -from snowflake.cli.api.project.schemas.commons import Artifacts from snowflake.cli.api.project.schemas.entities.common import ( + Artifacts, EntityModelBase, ExternalAccessBaseModel, ImportsBaseModel, + PathMapping, ) from snowflake.cli.api.project.schemas.updatable_model import ( DiscriminatorField, ) -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import PathMapping from snowflake.cli.api.project.schemas.v1.snowpark.argument import Argument diff --git a/src/snowflake/cli/_plugins/snowpark/snowpark_project_paths.py b/src/snowflake/cli/_plugins/snowpark/snowpark_project_paths.py index cbc05e2c2d..6e103d840e 100644 --- a/src/snowflake/cli/_plugins/snowpark/snowpark_project_paths.py +++ b/src/snowflake/cli/_plugins/snowpark/snowpark_project_paths.py @@ -20,13 +20,13 @@ from pathlib import Path, PurePosixPath from typing import Optional -from snowflake.cli._plugins.snowpark.snowpark_entity_model import PathMapping from snowflake.cli._plugins.snowpark.zipper import zip_dir from snowflake.cli.api.console import cli_console from snowflake.cli.api.constants import DEPLOYMENT_STAGE from snowflake.cli.api.feature_flags import FeatureFlag from snowflake.cli.api.identifiers import FQN from snowflake.cli.api.project.project_paths import ProjectPaths +from snowflake.cli.api.project.schemas.entities.common import PathMapping from snowflake.cli.api.secure_path import SecurePath diff --git a/src/snowflake/cli/_plugins/streamlit/manager.py b/src/snowflake/cli/_plugins/streamlit/manager.py index a83f553df2..4b677c903e 100644 --- a/src/snowflake/cli/_plugins/streamlit/manager.py +++ b/src/snowflake/cli/_plugins/streamlit/manager.py @@ -40,7 +40,7 @@ from snowflake.cli.api.console import cli_console from snowflake.cli.api.feature_flags import FeatureFlag from snowflake.cli.api.identifiers import FQN -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import PathMapping +from snowflake.cli.api.project.schemas.entities.common import PathMapping from snowflake.cli.api.sql_execution import SqlExecutionMixin from snowflake.connector.cursor import SnowflakeCursor from snowflake.connector.errors import ProgrammingError diff --git a/src/snowflake/cli/_plugins/streamlit/streamlit_entity_model.py b/src/snowflake/cli/_plugins/streamlit/streamlit_entity_model.py index 0ffcf8f124..f0e6a8c43e 100644 --- a/src/snowflake/cli/_plugins/streamlit/streamlit_entity_model.py +++ b/src/snowflake/cli/_plugins/streamlit/streamlit_entity_model.py @@ -16,16 +16,16 @@ from typing import Literal, Optional from pydantic import Field, field_validator -from snowflake.cli.api.project.schemas.commons import Artifacts from snowflake.cli.api.project.schemas.entities.common import ( + Artifacts, EntityModelBase, ExternalAccessBaseModel, ImportsBaseModel, + PathMapping, ) from snowflake.cli.api.project.schemas.updatable_model import ( DiscriminatorField, ) -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import PathMapping class StreamlitEntityModel(EntityModelBase, ExternalAccessBaseModel, ImportsBaseModel): diff --git a/src/snowflake/cli/api/artifacts/bundle_map.py b/src/snowflake/cli/api/artifacts/bundle_map.py index 93089f71e2..b60ac9e501 100644 --- a/src/snowflake/cli/api/artifacts/bundle_map.py +++ b/src/snowflake/cli/api/artifacts/bundle_map.py @@ -11,7 +11,7 @@ SourceNotFoundError, TooManyFilesError, ) -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import PathMapping +from snowflake.cli.api.project.schemas.entities.common import PathMapping from snowflake.cli.api.utils.path_utils import resolve_without_follow ArtifactPredicate = Callable[[Path, Path], bool] diff --git a/src/snowflake/cli/api/project/schemas/commons.py b/src/snowflake/cli/api/project/schemas/commons.py deleted file mode 100644 index b512afbb39..0000000000 --- a/src/snowflake/cli/api/project/schemas/commons.py +++ /dev/null @@ -1,5 +0,0 @@ -from typing import List, Union - -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import PathMapping - -Artifacts = List[Union[PathMapping, str]] diff --git a/src/snowflake/cli/api/project/schemas/entities/common.py b/src/snowflake/cli/api/project/schemas/entities/common.py index d9036d9a4c..3031cb4126 100644 --- a/src/snowflake/cli/api/project/schemas/entities/common.py +++ b/src/snowflake/cli/api/project/schemas/entities/common.py @@ -15,7 +15,7 @@ from __future__ import annotations from abc import ABC -from typing import Dict, Generic, List, Optional, TypeVar, Union +from typing import Any, Dict, Generic, List, Optional, TypeVar, Union from pydantic import Field, PrivateAttr, field_validator from snowflake.cli.api.identifiers import FQN @@ -162,3 +162,76 @@ def get_secrets_sql(self) -> str | None: return None secrets = ", ".join(f"'{key}'={value}" for key, value in self.secrets.items()) return f"secrets=({secrets})" + + +class ProcessorMapping(UpdatableModel): + name: str = Field( + title="Name of a processor to invoke on a collection of artifacts." + ) + properties: Optional[Dict[str, Any]] = Field( + title="A set of key-value pairs used to configure the output of the processor. Consult a specific processor's documentation for more details on the supported properties.", + default=None, + ) + + +class PathMapping(UpdatableModel): + src: str = Field( + title="Source path or glob pattern (relative to project root)", default=None + ) + + dest: Optional[str] = Field( + title="Destination path on stage", + description="Paths are relative to stage root; paths ending with a slash indicate that the destination is a directory which source files should be copied into.", + default=None, + ) + + processors: Optional[List[Union[str, ProcessorMapping]]] = Field( + title="List of processors to apply to matching source files during bundling.", + default=[], + ) + + @field_validator("processors") + @classmethod + def transform_processors( + cls, input_values: Optional[List[Union[str, Dict, ProcessorMapping]]] + ) -> List[ProcessorMapping]: + if input_values is None: + return [] + + transformed_processors: List[ProcessorMapping] = [] + for input_processor in input_values: + if isinstance(input_processor, str): + transformed_processors.append(ProcessorMapping(name=input_processor)) + elif isinstance(input_processor, Dict): + transformed_processors.append(ProcessorMapping(**input_processor)) + else: + transformed_processors.append(input_processor) + return transformed_processors + + +Artifacts = List[Union[PathMapping, str]] + + +class ArtifactsBaseModel(EntityModelBase): + artifacts: Artifacts = Field( + title="List of paths or file source/destination pairs to add to the deploy root", + ) + deploy_root: Optional[str] = Field( + title="Folder at the root of your project where the build step copies the artifacts", + default="output/deploy/", + ) + + @field_validator("artifacts") + @classmethod + def transform_artifacts(cls, orig_artifacts: Artifacts) -> List[PathMapping]: + transformed_artifacts: List[PathMapping] = [] + if orig_artifacts is None: + return transformed_artifacts + + for artifact in orig_artifacts: + if isinstance(artifact, PathMapping): + transformed_artifacts.append(artifact) + else: + transformed_artifacts.append(PathMapping(src=artifact)) + + return transformed_artifacts diff --git a/src/snowflake/cli/api/project/schemas/v1/native_app/native_app.py b/src/snowflake/cli/api/project/schemas/v1/native_app/native_app.py index d0c065c7f3..f1cab68139 100644 --- a/src/snowflake/cli/api/project/schemas/v1/native_app/native_app.py +++ b/src/snowflake/cli/api/project/schemas/v1/native_app/native_app.py @@ -18,14 +18,13 @@ from typing import List, Optional from pydantic import Field, field_validator -from snowflake.cli.api.project.schemas.commons import Artifacts +from snowflake.cli.api.project.schemas.entities.common import Artifacts, PathMapping from snowflake.cli.api.project.schemas.updatable_model import UpdatableModel from snowflake.cli.api.project.schemas.v1.native_app.application import ( Application, ApplicationV11, ) from snowflake.cli.api.project.schemas.v1.native_app.package import Package, PackageV11 -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import PathMapping from snowflake.cli.api.project.util import ( SCHEMA_AND_NAME, ) diff --git a/src/snowflake/cli/api/project/schemas/v1/native_app/path_mapping.py b/src/snowflake/cli/api/project/schemas/v1/native_app/path_mapping.py deleted file mode 100644 index ba9eaed997..0000000000 --- a/src/snowflake/cli/api/project/schemas/v1/native_app/path_mapping.py +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright (c) 2024 Snowflake Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from __future__ import annotations - -from typing import Any, Dict, List, Optional, Union - -from pydantic import Field, field_validator -from snowflake.cli.api.project.schemas.updatable_model import UpdatableModel - - -class ProcessorMapping(UpdatableModel): - name: str = Field( - title="Name of a processor to invoke on a collection of artifacts." - ) - properties: Optional[Dict[str, Any]] = Field( - title="A set of key-value pairs used to configure the output of the processor. Consult a specific processor's documentation for more details on the supported properties.", - default=None, - ) - - -class PathMapping(UpdatableModel): - src: str = Field( - title="Source path or glob pattern (relative to project root)", default=None - ) - - dest: Optional[str] = Field( - title="Destination path on stage", - description="Paths are relative to stage root; paths ending with a slash indicate that the destination is a directory which source files should be copied into.", - default=None, - ) - - processors: Optional[List[Union[str, ProcessorMapping]]] = Field( - title="List of processors to apply to matching source files during bundling.", - default=[], - ) - - @field_validator("processors") - @classmethod - def transform_processors( - cls, input_values: Optional[List[Union[str, Dict, ProcessorMapping]]] - ) -> List[ProcessorMapping]: - if input_values is None: - return [] - - transformed_processors: List[ProcessorMapping] = [] - for input_processor in input_values: - if isinstance(input_processor, str): - transformed_processors.append(ProcessorMapping(name=input_processor)) - elif isinstance(input_processor, Dict): - transformed_processors.append(ProcessorMapping(**input_processor)) - else: - transformed_processors.append(input_processor) - return transformed_processors diff --git a/tests/api/artifacts/test_bundle_map.py b/tests/api/artifacts/test_bundle_map.py index c74f319121..92964a5e69 100644 --- a/tests/api/artifacts/test_bundle_map.py +++ b/tests/api/artifacts/test_bundle_map.py @@ -27,7 +27,7 @@ SourceNotFoundError, TooManyFilesError, ) -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import PathMapping +from snowflake.cli.api.project.schemas.entities.common import PathMapping from snowflake.cli.api.utils.path_utils import resolve_without_follow from tests.nativeapp.utils import touch diff --git a/tests/helpers/__snapshots__/test_v1_to_v2.ambr b/tests/helpers/__snapshots__/test_v1_to_v2.ambr index ddfd878c1b..00c92bd693 100644 --- a/tests/helpers/__snapshots__/test_v1_to_v2.ambr +++ b/tests/helpers/__snapshots__/test_v1_to_v2.ambr @@ -232,8 +232,8 @@ meta: role: pkg_role identifier: <% fn.concat_ids('myapp', '_pkg_', fn.sanitize_id(fn.get_username('unknown_user')) | lower) %> - type: application package artifacts: [] + type: application package app: identifier: myapp_app type: application @@ -300,7 +300,6 @@ post_deploy: - sql_script: scripts/post_pkg_deploy.sql identifier: my_app_package - type: application package artifacts: - src: app/* dest: ./ @@ -311,8 +310,9 @@ - name: templates properties: foo: bar - bundle_root: my_output/my_bundle deploy_root: my_output/my_deploy + type: application package + bundle_root: my_output/my_bundle generated_root: __my_generated_files stage: app_src.my_stage scratch_stage: app_src.my_scratch @@ -432,10 +432,10 @@ meta: role: pkg_role identifier: <% fn.concat_ids('myapp', '_pkg_', fn.sanitize_id(fn.get_username('unknown_user')) | lower) %> - type: application package artifacts: - src: app/* dest: ./ + type: application package app: identifier: myapp_app type: application diff --git a/tests/nativeapp/codegen/snowpark/test_python_processor.py b/tests/nativeapp/codegen/snowpark/test_python_processor.py index 045dea8c10..27adfeb1d8 100644 --- a/tests/nativeapp/codegen/snowpark/test_python_processor.py +++ b/tests/nativeapp/codegen/snowpark/test_python_processor.py @@ -37,9 +37,7 @@ from snowflake.cli._plugins.nativeapp.entities.application_package import ( ApplicationPackageEntityModel, ) -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import ( - ProcessorMapping, -) +from snowflake.cli.api.project.schemas.entities.common import ProcessorMapping from tests.nativeapp.utils import assert_dir_snapshot from tests.testing_utils.files_and_dirs import pushd, temp_local_dir diff --git a/tests/nativeapp/codegen/templating/test_templates_processor.py b/tests/nativeapp/codegen/templating/test_templates_processor.py index 21c7160d06..d412fd5c86 100644 --- a/tests/nativeapp/codegen/templating/test_templates_processor.py +++ b/tests/nativeapp/codegen/templating/test_templates_processor.py @@ -26,7 +26,7 @@ ) from snowflake.cli._plugins.nativeapp.exceptions import InvalidTemplateInFileError from snowflake.cli.api.exceptions import InvalidTemplate -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import PathMapping +from snowflake.cli.api.project.schemas.entities.common import PathMapping from tests.nativeapp.utils import CLI_GLOBAL_TEMPLATE_CONTEXT diff --git a/tests/nativeapp/test_annotation_processor_config.py b/tests/nativeapp/test_annotation_processor_config.py index 24442b3efd..016565d1b4 100644 --- a/tests/nativeapp/test_annotation_processor_config.py +++ b/tests/nativeapp/test_annotation_processor_config.py @@ -14,9 +14,7 @@ import pytest from snowflake.cli.api.project.definition import load_project -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import ( - ProcessorMapping, -) +from snowflake.cli.api.project.schemas.entities.common import ProcessorMapping @pytest.mark.parametrize( diff --git a/tests/nativeapp/test_artifacts.py b/tests/nativeapp/test_artifacts.py index 5f571bc97c..3a36cf1e6f 100644 --- a/tests/nativeapp/test_artifacts.py +++ b/tests/nativeapp/test_artifacts.py @@ -30,7 +30,7 @@ TooManyFilesError, ) from snowflake.cli.api.project.definition import load_project -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import PathMapping +from snowflake.cli.api.project.schemas.entities.common import PathMapping from snowflake.cli.api.project.util import to_identifier from yaml import safe_dump diff --git a/tests/project/test_config.py b/tests/project/test_config.py index aa9e63834d..a1b809413c 100644 --- a/tests/project/test_config.py +++ b/tests/project/test_config.py @@ -20,10 +20,10 @@ import pytest from snowflake.cli.api.project.definition import load_project from snowflake.cli.api.project.errors import SchemaValidationError +from snowflake.cli.api.project.schemas.entities.common import PathMapping from snowflake.cli.api.project.schemas.project_definition import ( build_project_definition, ) -from snowflake.cli.api.project.schemas.v1.native_app.path_mapping import PathMapping from tests.nativeapp.factories import PdfV10Factory diff --git a/tests/project/test_project_definition_v2.py b/tests/project/test_project_definition_v2.py index e639f41cfa..614b2c046e 100644 --- a/tests/project/test_project_definition_v2.py +++ b/tests/project/test_project_definition_v2.py @@ -15,7 +15,6 @@ import pytest from snowflake.cli._plugins.snowpark.snowpark_entity_model import ( - PathMapping, SnowparkEntityModel, ) from snowflake.cli.api.project.definition_conversion import ( @@ -23,6 +22,7 @@ ) from snowflake.cli.api.project.definition_manager import DefinitionManager from snowflake.cli.api.project.errors import SchemaValidationError +from snowflake.cli.api.project.schemas.entities.common import PathMapping from snowflake.cli.api.project.schemas.entities.entities import ( ALL_ENTITIES, ALL_ENTITY_MODELS,