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

pkg_resources is deprecated as an API #1442

Closed
phargogh opened this issue Nov 4, 2023 · 0 comments · Fixed by #1443
Closed

pkg_resources is deprecated as an API #1442

phargogh opened this issue Nov 4, 2023 · 0 comments · Fixed by #1443
Assignees
Labels
bug Something isn't working in progress This issue is actively being worked on

Comments

@phargogh
Copy link
Member

phargogh commented Nov 4, 2023

When I run the SDR tests, I see some warnings that look like this:

============================================================================================================================ test session starts =============================================================================================================================
platform darwin -- Python 3.10.8, pytest-7.2.2, pluggy-1.0.0
rootdir: /Users/jdouglass/workspace/phargogh/invest, configfile: pytest.ini
plugins: xdist-3.2.1, anyio-3.6.2
collected 14 items

tests/test_sdr.py ..............                                                                                                                                                                                                                                       [100%]

============================================================================================================================== warnings summary ==============================================================================================================================
tests/test_sdr.py::SDRTests::test_base_regression
  /Users/jdouglass/workspace/phargogh/invest/env310/lib/python3.10/site-packages/pkg_resources/__init__.py:121: DeprecationWarning: pkg_resources is deprecated as an API
    warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)

tests/test_sdr.py::SDRTests::test_base_regression
tests/test_sdr.py::SDRTests::test_base_regression
tests/test_sdr.py::SDRTests::test_base_regression
tests/test_sdr.py::SDRTests::test_base_regression
  /Users/jdouglass/workspace/phargogh/invest/env310/lib/python3.10/site-packages/pkg_resources/__init__.py:2870: 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)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================================================================================= 14 passed, 5 warnings in 3.82s =======================================================================================================================

I'm not sure what to do about the sphinx warnings, but the others are all raised during from natcap.invest import sdr because we import pkg_resources within natcap/invest/__init__.py, as verified by a stack trace. The recommended way to read the version has changed, per the setuptools_scm docs: https://setuptools-scm.readthedocs.io/en/latest/usage/

@phargogh phargogh added bug Something isn't working in progress This issue is actively being worked on labels Nov 4, 2023
@phargogh phargogh self-assigned this Nov 4, 2023
phargogh added a commit to phargogh/invest that referenced this issue Nov 4, 2023
phargogh added a commit to phargogh/invest that referenced this issue Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in progress This issue is actively being worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant