-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Features/unification artifacts #1920
base: main
Are you sure you want to change the base?
Conversation
85d1c72
to
9cb87b3
Compare
Check if --project in streamlit works on this branch. |
bf62cfb
to
7cd92a3
Compare
2bee685
to
c15cca5
Compare
1ce276f
to
1d6e6c1
Compare
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)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"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)" |
I'm pretty sure that feature flags are read only as lowercase from config.toml
. SNOWFLAKE_CLI_FEATURES_ENABLE...
env variable also works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
|
||
def remove_up_bundle_root(self) -> None: | ||
if self.bundle_root.exists(): | ||
rmtree(self.bundle_root) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use SecurePath.rmdir(recursive=True)
instead of shutil.rmtree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
ssrc.copy(dst) | ||
else: | ||
# 1. Create a new directory in the deploy root | ||
dst.mkdir(exist_ok=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dst.mkdir(exist_ok=True) | |
SecurePath(dst).mkdir(exist_ok=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
absolute_root_in_deploy.mkdir(parents=True, exist_ok=True) | |
SecurePath(absolute_root_in_deploy).mkdir(parents=True, exist_ok=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docstring mentions Native Apps- we probably should make it CLI-wide
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
|
||
def __init__(self, *, project_root: Path, deploy_root: Path): | ||
# If a relative path ends up here, it's a bug in the app and can lead to other | ||
# subtle bugs as paths would be resolved relative to the current working directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this docstring just copied from Native App application?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is
Returns the canonical version of a source path, relative to the project root. | ||
""" | ||
absolute_src = self._absolute_src(src) | ||
return absolute_src.relative_to(self._project_root) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if artifact is in a different subtree? Do we handle the error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nativeapp code moved to common package.
:param deploy_root: The directory where artifacts should be copied to. Must be an absolute path. | ||
""" | ||
|
||
def __init__(self, *, project_root: Path, deploy_root: Path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sfc-gh-pczajka - shouldn't we use SecurePath everywhere? What's your opinion on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wherever possible - so if it won't cause cascade of changes, I'd change Path to SecurePath.
I remember that refactor to use it everywhere was problematic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will cause cascade :( , there will be a lot of changes in nativeapp code.
|
||
|
||
@dataclass(unsafe_hash=True) | ||
class Artefact: | ||
"""Helper for getting paths related to given artefact.""" | ||
|
||
project_root: Path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this logic to main bundle map files? It seems quite similiar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Artefact logic is only for Snowpark, for me better fits here.
) | ||
for artifact in self._entity_model.artifacts | ||
], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bundle is an action, so it should not return bundle but rather copy the files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
* Added glob support for Snowpark and Streamlit * Added glob support for Snowpark and Streamlit * Added glob support for Snowpark and Streamlit * Changed PathMapping.src to Path * Changes after review * Changes after review 2 * Revert "Changed PathMapping.src to Path" This reverts commit 3eb543d. * Changes after review 3 * Changes after review 4 * Added full global support * Renamed feature flag and added release notes * Removed or None
Fix feature branch gates
#1909) Moved Snowpark and Streamlit artifacts to separate directory in output/deploy
1d6e6c1
to
517a85f
Compare
Pre-review checklist
Changes description