Skip to content

pkg_resources is deprecated, reccomends porting to importlib.resources #5491

@acchamber

Description

@acchamber

📰 Custom Issue

When the iris pytests are ran, the following DeprecationWarnings appear

unit/experimental/ugrid/mesh/test_Connectivity.py:17
  /net/home/h05/achamber/git/iris/lib/iris/tests/unit/experimental/ugrid/mesh/test_Connectivity.py:17: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    from pkg_resources import parse_version

../../../../../../../../../home/h05/achamber/.conda/envs/iris-dev/lib/python3.11/site-packages/pkg_resources/__init__.py:2871
  /home/h05/achamber/.conda/envs/iris-dev/lib/python3.11/site-packages/pkg_resources/__init__.py:2871: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
  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)

../../../../../../../../../home/h05/achamber/.conda/envs/iris-dev/lib/python3.11/site-packages/pkg_resources/__init__.py:2871
  /home/h05/achamber/.conda/envs/iris-dev/lib/python3.11/site-packages/pkg_resources/__init__.py:2871: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('ruamel')`.
  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)

../../../../../../../../../home/h05/achamber/.conda/envs/iris-dev/lib/python3.11/site-packages/pkg_resources/__init__.py:2871
../../../../../../../../../home/h05/achamber/.conda/envs/iris-dev/lib/python3.11/site-packages/pkg_resources/__init__.py:2871
../../../../../../../../../home/h05/achamber/.conda/envs/iris-dev/lib/python3.11/site-packages/pkg_resources/__init__.py:2871
../../../../../../../../../home/h05/achamber/.conda/envs/iris-dev/lib/python3.11/site-packages/pkg_resources/__init__.py:2871
../../../../../../../../../home/h05/achamber/.conda/envs/iris-dev/lib/python3.11/site-packages/pkg_resources/__init__.py:2871
  /home/h05/achamber/.conda/envs/iris-dev/lib/python3.11/site-packages/pkg_resources/__init__.py:2871: 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)

Looking at the pkg_resources documentation it reccomends a shift to the inbuilt importlib.resources. I have not investigated fully if this fits Iris's needs or not.

Metadata

Metadata

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions