polygon-io/client-python

pkg_resources is deprecated as an API

bfoz opened this issue · 2 comments

bfoz commented

It appears that using pkg_resources in the way that the python client does, has been deprecated. I'm not sure when that happened; I only noticed it because I was digging through pytest logs and found this message:

=============================== warnings summary ===============================
../../../root/.local/share/virtualenvs/project04-a3eQwzyc/lib/python3.12/site-packages/polygon/rest/base.py:10
/root/.local/share/virtualenvs/project04-a3eQwzyc/lib/python3.12/site-packages/polygon/rest/base.py:10: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources # part of setuptools

tl;dr from the referenced link:

Use of pkg_resources is deprecated in favor of importlib.resources, importlib.metadata and their backports (importlib_resources, importlib_metadata). Some useful APIs are also provided by 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.

FWIW, making the recommended update would also fix #593.

Thanks for reporting. Added a PR for this #694.

#694 has been merged and a new v1.14.0 release published https://github.com/polygon-io/client-python/releases/tag/v1.14.0. Thanks for the suggestion -- it's nice to finally have this solved!

You can upgrade via pip install -U polygon-api-client.