Skip to content

Commit

Permalink
Fixes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-astus committed Jan 13, 2025
1 parent 83302c3 commit 517a85f
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/snowflake/cli/_plugins/streamlit/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/snowflake/cli/_plugins/streamlit/streamlit_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
[
Expand Down
2 changes: 1 addition & 1 deletion src/snowflake/cli/api/artifacts/bundle_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/snowflake/cli/api/artifacts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions src/snowflake/cli/api/project/project_paths.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/snowpark/__snapshots__/test_models.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
+------------------------------------------------------------------------------+

'''
Expand Down

0 comments on commit 517a85f

Please sign in to comment.