/path/to/test/lib/python3.10/site-packages/pkg_resources/__init__.py:2804: 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)
Is there a good guide for how to migrate from "old" namespace packages to "new" namespace packages? What is going to break if we just delete this __init__.py and how do we warn our users we are about to break them (I asked these in the linked setuptools issue as well)?
Medium difficulty because it requires understanding packaging related issues but good first issue because it requires no understanding of Matplotlib to do.
Tasks:
sort out what even needs to be done (just delete the __init__.py?)
document if / how this will break any downstream packages and how they also need to migrate
It is extremely important that every distribution that uses the namespace package omits the init.py or uses a pkgutil-style init.py. If any distribution does not, it will cause the namespace logic to fail and the other sub-packages will not be importable.
And from the same source:
Warning While native namespace packages and pkgutil-style namespace packages are largely compatible, pkg_resources-style namespace packages are not compatible with the other methods. It’s inadvisable to use different methods in different distributions that provide packages to the same namespace.
In other words, any dependent code that implements a mpl_toolkits.* subpackage will break immediately when the deprecated __init__.py is removed.
It also seems that there is no way for dependent code to support both implementations of namespace packages at the same time, so I assume they'll have to drop support for all versions of matplotlib previous to the one that does the change... or renounce supporting that version and newer ones.
I haven't found a solution to warn about the transition from within matplotlib, so currently my recommendation would be to just reach out to downstream developers by any means appropriate.
Is there a list of such sub packages somewhere that'd be relevant ? there seem to be only one on PyPI (https://pypi.org/project/mpl-toolkits.clifford/)
I remember facing this issue few years back and the conclusion was to avoid using namespaces in general. Much safer and you do not depend on someone else which could break you.
@tacaswell I just look the same resource on python version 3.10.10 and the excepted outcome was verified. I think that it just needs to update python to a newer version.
Activity
tacaswell commented on Feb 17, 2023
Is there a good guide for how to migrate from "old" namespace packages to "new" namespace packages? What is going to break if we just delete this __init__.py and how do we warn our users we are about to break them (I asked these in the linked setuptools issue as well)?
tacaswell commented on Feb 18, 2023
Medium difficulty because it requires understanding packaging related issues but good first issue because it requires no understanding of Matplotlib to do.
Tasks:
Ignore deprecated pkg_resources.declare_namespace warnings
Ignore deprecated pkg_resources.declare_namespace warnings
Filter matplotlib-related warnings
neutrinoceros commented on Feb 20, 2023
To answer this, I'll quote https://packaging.python.org/en/latest/guides/packaging-namespace-packages/#native-namespace-packages
And from the same source:
In other words, any dependent code that implements a mpl_toolkits.* subpackage will break immediately when the deprecated __init__.py is removed.
It also seems that there is no way for dependent code to support both implementations of namespace packages at the same time, so I assume they'll have to drop support for all versions of matplotlib previous to the one that does the change... or renounce supporting that version and newer ones.
I haven't found a solution to warn about the transition from within matplotlib, so currently my recommendation would be to just reach out to downstream developers by any means appropriate.
Is there a list of such sub packages somewhere that'd be relevant ? there seem to be only one on PyPI (https://pypi.org/project/mpl-toolkits.clifford/)
Ignore deprecated `pkg_resources.declare_namespace` warnings (#611)
ssbarnea commented on Mar 1, 2023
I remember facing this issue few years back and the conclusion was to avoid using namespaces in general. Much safer and you do not depend on someone else which could break you.
tacaswell commented on Mar 1, 2023
Per pypa/setuptools#3434 (comment) it seems we can just delete the __init__.py files and everything will be OK.
Filter matplotlib-related warnings (#2344)
BabaYaga1221 commented on Mar 12, 2023
@tacaswell I just look the same resource on python version 3.10.10 and the excepted outcome was verified. I think that it just needs to update python to a newer version.
correct me if I am wrong. Thanks
tacaswell commented on Mar 13, 2023
@BabaYaga1221 The dependency is on the version of setuptools (not the version of Python).
Ignore warnings in dev mode for now
test: ignore all DeprecatedWarning calls for pkg_resources.declare_na…
test: ignore all DeprecatedWarning calls for pkg_resources.declare_na…
Unpin setuptools, pytest, allow Python 3.11 (#2338)
Unpin setuptools, pytest, allow Python 3.11 (dials#2338)
Ignore deprecated `pkg_resources.declare_namespace` warnings (cctbx#611)