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

Ignore deprecation warnings for pkg_resources.declare_namespace usage #1919

Open
4 of 8 tasks
matrss opened this issue Aug 23, 2023 · 4 comments
Open
4 of 8 tasks

Ignore deprecation warnings for pkg_resources.declare_namespace usage #1919

matrss opened this issue Aug 23, 2023 · 4 comments
Assignees
Labels
upstream fix needed a dependency of us needs an improvement
Milestone

Comments

@matrss
Copy link
Collaborator

matrss commented Aug 23, 2023

These deprecation warnings in the CI runs come from dependencies which still use this deprecated method. There is not much we can do about this, apart from making sure they have a ticket about it in their respective issue tracker.

The following is the list of declared namespaces we see this warning coming from:

I'll tick these off as I make sure that the issue is handled or at least made aware of.

Apart from that I think we should just ignore this type of warning. That is also what others (xarray, ibis, SCT) are doing.

@matrss matrss added the upstream fix needed a dependency of us needs an improvement label Aug 23, 2023
@matrss matrss added this to the 9.0.0 milestone Aug 23, 2023
@matrss matrss self-assigned this Aug 23, 2023
@ReimarBauer
Copy link
Member

after this is done we will have also updated versions
#1750

@matrss
Copy link
Collaborator Author

matrss commented Aug 24, 2023

Actually this issue seems to be happening only due to pyfilesystem2 using pkg_resources, which is entirely deprecated.

If you just use xstatic for example, there is no issue:

>>> import warnings
>>> warnings.resetwarnings()
>>> from xstatic.main import XStatic

but as soon as pkg_resources is imported with xstatic installed in the same environment:

>>> import warnings
>>> warnings.resetwarnings()
>>> import pkg_resources
<stdin>:1: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
/home/icg149/mambaforge/envs/xstatic-report/lib/python3.11/site-packages/pkg_resources/__init__.py:2871: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('xstatic')`.
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/icg149/mambaforge/envs/xstatic-report/lib/python3.11/site-packages/pkg_resources/__init__.py:2871: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('xstatic.pkg')`.
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/icg149/mambaforge/envs/xstatic-report/lib/python3.11/site-packages/pkg_resources/__init__.py:2350: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('xstatic')`.
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(parent)

So I think getting that import removed from fs would silence all those DeprecationWarning's as well.

@ReimarBauer
Copy link
Member

ReimarBauer commented Apr 11, 2024

See also

xstatic-py/xstatic#14

@matrss
Copy link
Collaborator Author

matrss commented May 16, 2024

Not much we can do here, other than wait for fs to stop using this deprecated module, I think. I'll push this back to v10.

@matrss matrss modified the milestones: 9.0.0, 10.0.0 May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream fix needed a dependency of us needs an improvement
Projects
None yet
Development

No branches or pull requests

2 participants