Skip to content

DeprecationWarning for use of legacy importlib_resources API #184

Closed
@bskinn

Description

@bskinn

I'm seeing a DeprecationWarning in my tox matrix for bskinn/sphobjinv running with Python 3.11.0a4, which appears to be due to certifi's use of a legacy API from importlib_resources.

In a fresh virtual environment:

$ python -V -V
Python 3.11.0a4 (main, Jan 14 2022, 20:31:59) [GCC 10.2.1 20210110]

$ pip install certifi
Collecting certifi
  Using cached certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Installing collected packages: certifi
Successfully installed certifi-2021.10.8

$ pip list
Package    Version
---------- ---------
certifi    2021.10.8
pip        21.3.1
setuptools 60.2.0
wheel      0.37.1

$ python -W 'error' -c 'import certifi; certifi.where()'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File ".../lib/python3.11/site-packages/certifi/core.py", line 36, in where
    _CACERT_CTX = get_path("certifi", "cacert.pem")
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../python/3.11.0a4/lib/python3.11/importlib/resources/_legacy.py", line 18, in wrapper
    warnings.warn(
    ^^^^^^^^^^^^^^
DeprecationWarning: path is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.

Seems like it should be a pretty simple port to the new API. I'd be happy to attempt a PR if it's of interest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions