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

SNOW-1021381: Remove pkg_resource #2371

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

sfc-gh-yixie
Copy link
Collaborator

@sfc-gh-yixie sfc-gh-yixie commented Sep 30, 2024

  1. Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes SNOW-1021381

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
      • If this test skips Local Testing mode, I'm requesting review from @snowflakedb/local-testing
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am adding new credentials
    • I am adding a new dependency
    • If this is a new feature/behavior, I'm adding the Local Testing parity changes.
  3. Please describe how your code solves the related issue.
    Removed pkg_resources in code. Added cod that uses importlib (a python builtin package) and packaging (from pypa).
    Added packaging to the project dependency.

@sfc-gh-yixie sfc-gh-yixie marked this pull request as ready for review October 7, 2024 20:54
@sfc-gh-yixie sfc-gh-yixie requested review from a team as code owners October 7, 2024 20:54
@@ -23,6 +23,7 @@
"pyyaml",
"cloudpickle>=1.6.0,<=2.2.1,!=2.1.0,!=2.2.0;python_version<'3.11'",
"cloudpickle==2.2.1;python_version~='3.11'", # backend only supports cloudpickle 2.2.1 + python 3.11 at the moment
"packaging",
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need an approval from legal team?

Copy link
Contributor

Choose a reason for hiding this comment

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

Args:
name (str): The name of the package.

Returns:
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: It looks duplicate with description, so may not needed

package_name = package[: reg_match.start()] if reg_match else package

package_dict[package] = (package_name, use_local_version, package_req)
package_req = Requirement(package)
Copy link
Collaborator

Choose a reason for hiding this comment

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

so it's directly handled?

@@ -483,14 +513,12 @@ def add_snowpark_package(
channel.

Raises:
pkg_resources.DistributionNotFound: If the Snowpark Python Package is not installed in the local environment.
importlib.metadata.PackageNotFoundError: If the Snowpark Python Package is not installed in the local environment.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: do we need this in the change log for this error behavior change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is an internal API. But we do need to check if any public APIs expose it.

if package.key in DEFAULT_PACKAGES:
_logger.info(f"{package.key} is available by default, ignoring...")
if package.name in DEFAULT_PACKAGES:
_logger.info(f"{package.name} is availna meble by default, ignoring...")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
_logger.info(f"{package.name} is availna meble by default, ignoring...")
_logger.info(f"{package.name} is available by default, ignoring...")

Copy link
Contributor

@sfc-gh-aling sfc-gh-aling left a comment

Choose a reason for hiding this comment

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

let's kick off a stored proc test running for this

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