Skip to content
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

pkg_resources use discouraged #1723

Closed
DougBurke opened this issue Mar 6, 2023 · 2 comments · Fixed by #1750
Closed

pkg_resources use discouraged #1723

DougBurke opened this issue Mar 6, 2023 · 2 comments · Fixed by #1750

Comments

@DougBurke
Copy link
Contributor

setuptools 67.5.0 (released 05 Mar 2023) has this to say

Although pkg_resources has been discouraged for use, some projects still consider pkg_resources viable for usage. This change makes it clear that pkg_resources should not be used, emitting a DeprecationWarning when imported.

linked to pypa/setuptools#3843

We have one use case -

import pkg_resources
import numpy as np
# Used by printoptions
DISPLAY_WIDTH = 80
# The CSS file for the Notebook HTML code
CSS_FILE_PATH = "/".join(("static", "css", "style.css"))
CSS_STYLE = pkg_resources.resource_string("sherpa", CSS_FILE_PATH).decode("utf8")

@DougBurke
Copy link
Contributor Author

This is part of #1342 but I'll keep it as we can deal with pkg_resources separately from what we want to do about __file__.

@DougBurke
Copy link
Contributor Author

The replacement is easy - as we now require python > 3.7

https://importlib-resources.readthedocs.io/en/latest/migration.html#pkg-resources-resource-string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant