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 module is deprecated and should be replaced with importlib #283

Closed
ogajduse opened this issue Apr 9, 2024 · 0 comments · Fixed by #286
Closed

pkg_resources module is deprecated and should be replaced with importlib #283

ogajduse opened this issue Apr 9, 2024 · 0 comments · Fixed by #286

Comments

@ogajduse
Copy link
Member

ogajduse commented Apr 9, 2024

broker/broker/commands.py

Lines 160 to 163 in 6db4e5b

import pkg_resources
import requests
broker_version = pkg_resources.get_distribution("broker").version

produces the following deprecation warning:

  ../../lib64/python3.12/site-packages/pkg_resources/__init__.py:2832
    /opt/app-root/lib64/python3.12/site-packages/pkg_resources/__init__.py:2832: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('sphinxcontrib')`.
    Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
      declare_namespace(pkg)

Please note the "Attention" block on https://setuptools.pypa.io/en/latest/pkg_resources.html

Use of pkg_resources is deprecated in favor of [importlib.resources](https://docs.python.org/3.11/library/importlib.resources.html#module-importlib.resources), [importlib.metadata](https://docs.python.org/3.11/library/importlib.metadata.html#module-importlib.metadata) and their backports ([importlib_resources](https://pypi.org/project/importlib_resources), [importlib_metadata](https://pypi.org/project/importlib_metadata)). Some useful APIs are also provided by [packaging](https://pypi.org/project/packaging) (e.g. requirements and version parsing). Users should refrain from new usage of pkg_resources and should work to port to importlib-based solutions.
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 a pull request may close this issue.

1 participant