Skip to content
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

Fix for glob patterns in artifacts #1567

Closed
wants to merge 7 commits into from

Conversation

sfc-gh-jsikorski
Copy link
Contributor

@sfc-gh-jsikorski sfc-gh-jsikorski commented Sep 12, 2024

Pre-review checklist

  • I've confirmed that instructions included in README.md are still correct after my changes in the codebase.
  • I've added or updated automated unit tests to verify correctness of my new code.
  • I've added or updated integration tests to verify correctness of my new code.
  • I've confirmed that my changes are working by executing CLI's commands manually on MacOS.
  • I've confirmed that my changes are working by executing CLI's commands manually on Windows.
  • I've confirmed that my changes are up-to-date with the target branch.
  • I've described my changes in the release notes.
  • I've described my changes in the section below.

Changes description

Fix for #1529 - allows using glob patterns in artifact fields.
Adds getters, to ensure that the Snowpark artefacts are returned as a list of PathMappings

@sfc-gh-jsikorski sfc-gh-jsikorski marked this pull request as ready for review September 12, 2024 11:48
if "*" in str(artefact):
raise ValueError("Glob patterns not supported for Snowpark artifacts.")
return artifacts
def get_artifacts(self) -> List[PathMapping]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NADE's path globbing logic is centralized in BundleMap. Any particular reason we can't reuse it here instead of doing a one-off implementation? I'm worried that different glob expansion implementations will end up making things confusing for customers since the specific globbing semantics can diverge over time (and reading what's below, might have diverged already TBH).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we call BundleMap from Streamlit and Snowpark plugins, or extract this code to any common module?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If BundleMap is generic and easy to use we can use this implementation. If it's too tightly coupled with NA implementation I'm in favor of solving this in separate PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's intended to be generic, but feel free to take a look and tell me what you think.

RELEASE-NOTES.md Outdated Show resolved Hide resolved
main_file: streamlit_app.py
artifacts:
- streamlit_app.py
- pages/*.*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, and particular reason to use *.*, instead of just *? I've never seen that pattern used before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No particular reason. In this context they should have the same result.

_artifacts = []
for artifact in self.artifacts:
if "*" in str(artifact):
root = artifact.parent.absolute() if "**" not in str(artifact) else Path(".")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, is this also supposed to support **/*-style paths? That would be excellent!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should

@sfc-gh-turbaszek sfc-gh-turbaszek force-pushed the jsikorski/create_getter_for_artifacts branch from 547af2a to 5f5aef2 Compare September 19, 2024 07:56
auto-merge was automatically disabled September 30, 2024 13:28

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants