diff --git a/src/snowflake/cli/_plugins/snowpark/snowpark_entity_model.py b/src/snowflake/cli/_plugins/snowpark/snowpark_entity_model.py index 236742b7e4..4ecfd72e9b 100644 --- a/src/snowflake/cli/_plugins/snowpark/snowpark_entity_model.py +++ b/src/snowflake/cli/_plugins/snowpark/snowpark_entity_model.py @@ -60,7 +60,7 @@ def _convert_artifacts(cls, artifacts: Union[dict, str]): or (isinstance(artifact, PathMapping) and glob.has_magic(artifact.src)) ) and FeatureFlag.ENABLE_SNOWPARK_GLOB_SUPPORT.is_disabled(): raise ValueError( - "If you want to use glob patterns in artifacts, you need to enable the Snowpark new build feature flag (ENABLE_SNOWPARK_GLOB_SUPPORT=true)" + "If you want to use glob patterns in artifacts, you need to enable the Snowpark new build feature flag (enable_snowpark_glob_support=true)" ) if isinstance(artifact, PathMapping): _artifacts.append(artifact) diff --git a/src/snowflake/cli/_plugins/streamlit/manager.py b/src/snowflake/cli/_plugins/streamlit/manager.py index c8acac536f..286879d0e1 100644 --- a/src/snowflake/cli/_plugins/streamlit/manager.py +++ b/src/snowflake/cli/_plugins/streamlit/manager.py @@ -83,7 +83,7 @@ def _put_streamlit_files( absolute=True, expand_directories=True ): if absolute_src.is_file(): - # We treat the bundle root as deploy root + # We treat the bundle/streamlit root as deploy root symlink_or_copy( absolute_src, absolute_dest, diff --git a/src/snowflake/cli/_plugins/streamlit/streamlit_entity.py b/src/snowflake/cli/_plugins/streamlit/streamlit_entity.py index d55cd76f1a..1f68975d28 100644 --- a/src/snowflake/cli/_plugins/streamlit/streamlit_entity.py +++ b/src/snowflake/cli/_plugins/streamlit/streamlit_entity.py @@ -72,7 +72,7 @@ def action_get_url( ) def bundle(self, output_dir: Optional[Path] = None): - return build_bundle( + build_bundle( self.root, output_dir or bundle_root(self.root, "streamlit"), [ diff --git a/src/snowflake/cli/api/artifacts/bundle_map.py b/src/snowflake/cli/api/artifacts/bundle_map.py index b60ac9e501..24da09c3f9 100644 --- a/src/snowflake/cli/api/artifacts/bundle_map.py +++ b/src/snowflake/cli/api/artifacts/bundle_map.py @@ -34,7 +34,7 @@ def _specifies_directory(s: str) -> bool: class BundleMap: """ Computes the mapping between project directory artifacts (aka source artifacts) to their deploy root location - (aka destination artifact). This information is primarily used when bundling a native applications project. + (aka destination artifact). :param project_root: The root directory of the project and base for all relative paths. Must be an absolute path. :param deploy_root: The directory where artifacts should be copied to. Must be an absolute path. diff --git a/src/snowflake/cli/api/artifacts/utils.py b/src/snowflake/cli/api/artifacts/utils.py index cbc2b9edb0..96fe0b29b0 100644 --- a/src/snowflake/cli/api/artifacts/utils.py +++ b/src/snowflake/cli/api/artifacts/utils.py @@ -35,12 +35,12 @@ def symlink_or_copy(src: Path, dst: Path, deploy_root: Path) -> None: ssrc.copy(dst) else: # 1. Create a new directory in the deploy root - dst.mkdir(exist_ok=True) + sdst.mkdir(exist_ok=True) # 2. For all children of src, create their counterparts in dst now that it exists for root, _, files in sorted(os.walk(absolute_src, followlinks=True)): relative_root = Path(root).relative_to(absolute_src) absolute_root_in_deploy = Path(dst, relative_root) - absolute_root_in_deploy.mkdir(parents=True, exist_ok=True) + SecurePath(absolute_root_in_deploy).mkdir(parents=True, exist_ok=True) for file in sorted(files): absolute_file_in_project = Path(absolute_src, relative_root, file) absolute_file_in_deploy = Path(absolute_root_in_deploy, file) diff --git a/src/snowflake/cli/api/project/project_paths.py b/src/snowflake/cli/api/project/project_paths.py index 544fa36dbf..30b30f4467 100644 --- a/src/snowflake/cli/api/project/project_paths.py +++ b/src/snowflake/cli/api/project/project_paths.py @@ -1,6 +1,7 @@ from dataclasses import dataclass from pathlib import Path -from shutil import rmtree + +from snowflake.cli.api.secure_path import SecurePath @dataclass @@ -13,7 +14,7 @@ def bundle_root(self) -> Path: def remove_up_bundle_root(self) -> None: if self.bundle_root.exists(): - rmtree(self.bundle_root) + SecurePath(self.bundle_root).rmdir(recursive=True) def bundle_root(root: Path, app_type: str | None = None) -> Path: diff --git a/tests/snowpark/__snapshots__/test_models.ambr b/tests/snowpark/__snapshots__/test_models.ambr index 9564dc9303..26e57a335f 100644 --- a/tests/snowpark/__snapshots__/test_models.ambr +++ b/tests/snowpark/__snapshots__/test_models.ambr @@ -7,7 +7,7 @@ | For field entities.hello_procedure.procedure.artifacts you provided | | '['src/*']'. This caused: Value error, If you want to use glob patterns in | | artifacts, you need to enable the Snowpark new build feature flag | - | (ENABLE_SNOWPARK_GLOB_SUPPORT=true) | + | (enable_snowpark_glob_support=true) | +------------------------------------------------------------------------------+ '''