Skip to content

Conversation

@scbedd
Copy link
Member

@scbedd scbedd commented Jun 20, 2025

We have a base dependency on packaging and we are leaning on that for the modules that are deprecating in setuptools. Resolves #41698

Remaining identified files:

  • scripts/devops_tasks/common_tasks.py (used with target path in test_regression.py)
  • common/smoketest/dependencies.py
  • scripts/devops_tasks/tox_harness.py
  • scripts/multiapi_init_gen.py

After pullrequest runs successfully, we should also try a couple runs to be confident in this:

@scbedd scbedd self-assigned this Jun 20, 2025
Copilot AI review requested due to automatic review settings June 20, 2025 19:17
Copy link
Contributor

Copilot AI left a 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]:

@scbedd scbedd moved this from 🤔 Triage to 🔬 Dev in PR in Azure SDK EngSys ❄️🎄🎁🎅✨ Jun 20, 2025
@scbedd scbedd changed the title Remove all usage of deprecating pkg_resources Remove all usage of pkg_resources Jun 20, 2025
@scbedd
Copy link
Member Author

scbedd commented Jun 25, 2025

@msyyc hey Yuchao can you please take a look at specifically multiapi_init_gen. I am removing the explicit addition of the azure namespace....I am pretty certain that this should "just work" given PEP 420 implicit namespace packages.

When I used the cheatsheet.md to try generating, I just fail to generate for packages like azure-mgmt-appconfiguration no matter what. Regardless of my change.

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 scripts/multiapi_init_gen.py?

@msyyc
Copy link
Member

msyyc commented Jun 25, 2025

@scbedd I test your PR locally and it has no impact for sdk generation. As for scripts/multiapi_init_gen.py, it is not used by sdk generation. According to github history, this file was committed 6 years ago and I never change/use it.

@scbedd
Copy link
Member Author

scbedd commented Jun 25, 2025

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 !

@scbedd scbedd merged commit 00fcd5c into main Jun 25, 2025
61 checks passed
@scbedd scbedd deleted the remove-pkg-resources branch June 25, 2025 18:53
@kurtzeborn kurtzeborn moved this from 🔬 Dev in PR to 🎊 Closed in Azure SDK EngSys ❄️🎄🎁🎅✨ Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Eliminate dependence on pkg_resources

4 participants