fralau / mkdocs-macros-plugin

Create richer and more beautiful pages in MkDocs, by using variables and calls to macros in the markdown code.
https://mkdocs-macros-plugin.readthedocs.io
Other
318 stars 50 forks source link

DeprecationWarning: pkg_resources is deprecated as an API #220

Closed msoutopico closed 4 months ago

msoutopico commented 4 months ago

The plugins/macros section in my mkdocs.yml file says:

  - macros:
      verbose: true
      include_dir: docs/en/_includes

When I run mkdocs serve, the I get the following warnings at the top of the output:

INFO     -  DeprecationWarning: pkg_resources is deprecated as an API
              File "/home/souto/.cache/pypoetry/virtualenvs/omegat-guides-3pPVScJG-py3.11/lib/python3.11/site-packages/mkdocs_macros/context.py", line 19, in
            <module>
                import pkg_resources
              File "/home/souto/.cache/pypoetry/virtualenvs/omegat-guides-3pPVScJG-py3.11/lib/python3.11/site-packages/pkg_resources/__init__.py", line 121, in
            <module>
                warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)
INFO     -  Building documentation...

The site seems to serve well, with a few issues that I'm investigating at the moment (I don't know whether they are related). Thanks!

github-actions[bot] commented 4 months ago

Welcome to this project and thank you!' first issue

fralau commented 4 months ago

Thanks for the heads up.

I checked the offending line in the code, line 19 of context.py.

from importlib.metadata import version as package_version

That is a standard Python library. If you get a warning from calling it, it might be something connected to your system's Python 3.11 standard packages?

I do not know the ins and outs, but I would try to update the Python version (without jumping all the way to 3.12, you might try to get a more recent minor version?).

msoutopico commented 4 months ago

I fiddled a bit with dependencies, I have now ^3.10 as the python version in the poetry config. Not sure what it was, but the warnings don't appear anymore. Thanks for your reply.