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
replace pkg_resources with importlib.metadata from stdlib #3333
base: master
Are you sure you want to change the base?
Conversation
df1c0ab
to
5e36da7
Compare
i wonder if this is going to make a difference in load-time of obspy :-) |
5e36da7
to
fa1978c
Compare
No idea, just wanted to act on that Rebased after merging current maintenance branch into master |
Looks like
|
fa1978c
to
5450d4e
Compare
pkg_resources recently started showing this message: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
cdd4f64
to
c2657b7
Compare
This is starting to get ugly with the workarounds needed for Py 3.8 and 3.9. Maybe best make this switch after dropping Py 3.9 and until then just add an ignore rule for that deprecation warning on Py 3.12 |
# can not find proper documentation for how exactly these requirement | ||
# strings are defined, but it looks like a semicolon is used as a | ||
# separator for additional definitions like "extra" in optional | ||
# dependencies and old pkg_resources ignored those, so skip them with | ||
# importlib too |
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 think it follows PEP508; you could parse it with packaging
.
format_ep.dist.key, 'obspy.plugin.event.%s' % (format_ep.name), | ||
'writeFormat') | ||
format_ep.dist.name, | ||
'obspy.plugin.event.%s' % (format_ep.name), 'writeFormat') |
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.
Are we able to change all of these to f-strings? There are quite a few of these, and they're all a bit different, such as this one having superfluous parentheses.
What does this PR do?
Replaces
pkg_resources
which was used internally to handle entry points / plugin structure withimportlib.metadata
API. TheEntryPoint
objects fromimportlib
(and other objects likeDistribution
all have very minor differences to the oldpkg_resources
objects but most of these routines are private and not intended for public use. Hopefully tests catch all use cases.Why was it initiated? Any relevant Issues?
pkg_resources recently started showing this message:
PR Checklist
master
for new features,maintenance_...
for bug fixesno_ci
label can be added to skip CI buildsJust add the
build_docs
tag to this PR.Docs will be served at docs.obspy.org/pr/{branch_name} (do not use master branch).
Please post a link to the relevant piece of documentation.
clients.fdsn
) should be tested for the PR,just add the
test_network
tag to this PR.CHANGELOG.txt
.CONTRIBUTORS.txt
.from all the CI builds look correct. Add the "upload_plots" tag so that plotting
outputs are attached as artifacts.
CODEOWNERS
with your github handleready for review
label when you are ready for the PR to be reviewed.