-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Reduce usage of pkg_resources
#3792
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…g_resources in dist.py
jaraco
approved these changes
Feb 7, 2023
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.
I haven't reviewed this in detail, but love the broad strokes. Thanks for doing this work.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an attempt to reduce the usage of
pkg_resources
(and in some places to delay the associated import1).Summary of changes
The approaches used are:
packaging
andimportlib.metadata
_normalization
,_path
pkg_resources
to as few modules as possible (ideally only the ones that inevitably have to traverse deprecated code paths).pkg_resources
in an attempt saving the import cost when the module is not necessary.pkg_resources
inversion.py
editable_wheel
anddist_info
into_normalization
_normalization
topkg_resources
indevelop.py
_normalization
and importlib_metadata topkg_resources
indist.py
_normalization
topkg_resources
inegg_info.py
packaging
topkg_resources
inegg_info.py
packaging
topkg_resources
indist.py
for markersegg_info.py
topkg_resources.Distribution.egg_name
packaging
instead forpkg_resources
for version inwheel.py
_reqs.py
to favourpackaging
overpkg_resources
pkg_resources
fromdist.py
toinstaller.py
pkg_resources
ininstall_scripts.py
_normalization.path
with_path.samepath
and_path.normpath
I created the following diagram manually (it can be incorrect) to represent the main modules where
pkg_resources
is still used after the change in the PR.The red boxes represent the parts where it is very difficult to replace
pkg_resources
and we might just have to wait the end of the deprecation period to remove...The yellow boxes represent parts to which I believe we could add explicit deprecations.
Pull Request Checklist
changelog.d/
.(See documentation for details)
Footnotes
The idea behind delaying the import is that ideally only users that touch deprecated code paths should pay the cost of initializing
pkg_resources
. ↩