-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Remove all usage of pkg_resources
#41701
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
Conversation
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.
Pull Request Overview
This PR removes all usage of the deprecated pkg_resources module in favor of the packaging library's requirements API, helping modernize the dependency management in the SDK tools. Key changes include replacing pkg_resources imports with packaging.requirements, updating lambdas to access the requirement name attribute, and adjusting type hints and direct instantiation accordingly.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/azure-sdk-tools/tests/test_conflict_resolution.py | Replaced pkg_resources Requirement with packaging.requirements Requirement. |
| tools/azure-sdk-tools/ci_tools/parsing/parse_functions.py | Removed pkg_resources usage and changed attribute access from key to name in lambda filters. |
| tools/azure-sdk-tools/ci_tools/functions.py | Updated Requirement usage in parsing and compatibility checks. |
| tools/azure-sdk-tools/ci_tools/dependency_analysis.py | Removed pkg_resources usage; updated get_known_versions return type and adjusted requirement instantiation. |
| eng/tox/run_sphinx_build.py | Removed pkg_resources import. |
| eng/tox/prep_sphinx_env.py | Removed pkg_resources import and added initialization to ensure proper output assignment. |
Comments suppressed due to low confidence (1)
tools/azure-sdk-tools/ci_tools/dependency_analysis.py:32
- The return type of get_known_versions has been updated from List[str] to List[Version]; ensure that all callers are adapted to handle Version objects accordingly.
def get_known_versions(package_name: str) -> List[Version]:
pkg_resourcespkg_resources
…within common_tasks.py will be harder
|
@msyyc hey Yuchao can you please take a look at specifically When I used the Can you please run a quick check for a package you're updating/updated recently and confirm that this change is good to go with this change to |
|
@scbedd I test your PR locally and it has no impact for sdk generation. As for |
|
Ok. We need to clean up references to this file then. I'll submit a PR and have you review it for correctness. Thank you @msyyc ! |
We have a base dependency on
packagingand we are leaning on that for the modules that are deprecating insetuptools. Resolves #41698Remaining identified files:
scripts/devops_tasks/common_tasks.py(used with target path in test_regression.py)common/smoketest/dependencies.pyscripts/devops_tasks/tox_harness.pyscripts/multiapi_init_gen.pyAfter
pullrequestruns successfully, we should also try a couple runs to be confident in this: