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

Deprecation Warning: pkg_resources #157

Closed
niklasfink opened this issue Mar 22, 2023 · 7 comments
Closed

Deprecation Warning: pkg_resources #157

niklasfink opened this issue Mar 22, 2023 · 7 comments
Labels
fixed A fix has been submitted

Comments

@niklasfink
Copy link

When serving/building mkdocs with the macros plugin enabled:

INFO - DeprecationWarning: pkg_resources is deprecated as an API
File "/usr/local/python/3.11.2/lib/python3.11/site-packages/mkdocs_macros/context.py", line 19, in
import pkg_resources
File "/usr/local/python/3.11.2/lib/python3.11/site-packages/pkg_resources/init.py", line 121, in
warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)

@fralau
Copy link
Owner

fralau commented Apr 22, 2023

This might be an issue with python 3.11? 🤔

@fralau fralau added the help wanted Extra attention is needed label Apr 22, 2023
@johnthagen
Copy link

I'm getting this warning even on Python 3.10

nox > mkdocs serve
INFO     -  DeprecationWarning: pkg_resources is deprecated as an API
              File "lib/python3.10/site-packages/mkdocs_macros/context.py", line 19, in <module>
                import pkg_resources
              File "lib/python3.10/site-packages/pkg_resources/__init__.py", line 121, in <module>
                warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)

Environment

  • Python 3.10.11
mkdocs                     1.4.2
mkdocs-htmlproofer-plugin  0.13.1
mkdocs-macros-plugin       0.7.0
mkdocs-material            9.1.7
mkdocs-material-extensions 1.1.1
mkdocs-video               1.5.0

@johnthagen
Copy link

johnthagen commented Apr 24, 2023

Here are some upstream information about pkg_resources as a whole being deprecated:

This module is deprecated. Users are directed to
`importlib.resources <https://docs.python.org/3/library/importlib.resources.html>`_
and
`importlib.metadata <https://docs.python.org/3/library/importlib.metadata.html>`_
instead.

@johnthagen
Copy link

johnthagen commented Apr 24, 2023

The replacements in the standard library:

Given that Python 3.7 is end of life in just two months I would recommend bumping the minimum supported Python to 3.8 here:

https://github.com/fralau/mkdocs_macros_plugin/blob/e8e0356a2983c1f0604a4fba021c718e80cc011d/setup.py#L43

And then replace usages of pkg_resources with importlib from the standard library.

fralau pushed a commit that referenced this issue Apr 24, 2023
  - This has been replaced by importlib.metadata.
    Since version 3.7 of Python is end of life, the minimal version of
    python supported is now 3.8.
@fralau
Copy link
Owner

fralau commented Apr 24, 2023

This warning should be solved, and minimal version of Python has been bumped to 3.8. Could you please test if that works for you?

(that will also be an opportunity to test if version 1.1.0-alpha works for the rest)

@fralau fralau added fixed A fix has been submitted and removed help wanted Extra attention is needed labels Apr 24, 2023
@johnthagen
Copy link

johnthagen commented Apr 27, 2023

@fralau I installed the latest master branch into my Poetry environment with:

python -m pip install git+https://github.com/fralau/mkdocs_macros_plugin.git
$ python -m pip list | grep mkdocs
mkdocs                     1.4.2
mkdocs-htmlproofer-plugin  0.13.1
mkdocs-macros-plugin       1.0.0a0
mkdocs-material            9.1.7
mkdocs-material-extensions 1.1.1
mkdocs-video               1.5.0

Everything seemed to work, and I did not see any deprecation warnings printed. 🎉

@fralau
Copy link
Owner

fralau commented Apr 27, 2023

@johnthagen This is excellent!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed A fix has been submitted
Projects
None yet
Development

No branches or pull requests

3 participants