Skip to content

Remove pkg_resources usage from installer (and more) #4997

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

Merged
merged 8 commits into from
May 14, 2025

Conversation

jaraco
Copy link
Member

@jaraco jaraco commented May 13, 2025

  • Remove comments referring to pkg_resources and inline a compatibility behavior with its explanation.
  • Set the due date for installer removal (same as easy_install and package_index).
  • Rely on importlib.metadata to detect presence of wheel.
  • Replace pkg_resources with packaging.requirements.
  • Migrated installer to avoid pkg_resources.

Summary of changes

Ref #3085

Pull Request Checklist

@jaraco jaraco marked this pull request as ready for review May 13, 2025 21:34
pkg_resources.working_set.add(dist, replace=True)
# dist.locate_file('') is the directory containing EGG-INFO, where the importabl
# contents can be found.
sys.path.insert(0, str(dist.locate_file('')))
Copy link
Member Author

Choose a reason for hiding this comment

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

The biggest diff is in this change, which instead of relying of the pkg_resources.working_set, simply makes the package available on sys.path. There are probably some scenarios in which working_set provides more sophistication (possibly overriding already imported packages), but my instinct is that risk is low given the limited scope of setup_requires outside of pep517 these days.

@jaraco jaraco merged commit f2748d1 into main May 14, 2025
37 of 44 checks passed
@jaraco jaraco deleted the feature/remove-more-pkg_resources branch May 14, 2025 19:49
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.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy