Issue 1:
Bug report

Bug summary

I am building python-matplotlib RPM for Fedora and I've found out that I cannot execute tests because the file mpl_toolkits/__init__.py is missing.

Code for reproduction

MATPLOTLIBDATA=$PWD/lib/matplotlib/mpl-data/ PYTHONPATH=/builddir/build/BUILDROOT/python-matplotlib-2.1.0-1.fc28.2.x86_64/usr/lib64/python2.7/site-packages/ python tests.py

Actual outcome

('Python byte-compilation optimization level:', 0)
========================================== test session starts ==========================================
platform linux2 -- Python 2.7.14, pytest-3.2.3, py-1.5.2, pluggy-0.4.0
rootdir: /builddir/build/BUILD/matplotlib-2.1.0, inifile: pytest.ini

===================================== no tests ran in 0.00 seconds ======================================
ERROR: file or package not found: mpl_toolkits.tests (missing __init__.py?)

$ cat setup.cfg
[packages]
tests = True
toolkits_tests = True

[rc_options]
backend = TkAgg
$ cd /builddir/build/BUILDROOT/python-matplotlib-2.1.0-1.fc28.2.x86_64/usr/lib64/python2.7/site-packages/mpl_toolkits/
$ ll
total 92
drwxr-xr-x. 2 mockbuild mock 4096 Nov 21 11:44 axes_grid
drwxr-xr-x. 2 mockbuild mock 4096 Nov 21 11:44 axes_grid1
drwxr-xr-x. 2 mockbuild mock 4096 Nov 21 11:44 axisartist
-rw-r--r--. 1 mockbuild mock 3966 Oct 3 08:50 exceltools.py
-rw-r--r--. 2 mockbuild mock 3966 Nov 21 11:44 exceltools.pyc
-rw-r--r--. 2 mockbuild mock 3966 Nov 21 11:44 exceltools.pyo
-rw-r--r--. 1 mockbuild mock 19211 Oct 3 08:50 gtktools.py
-rw-r--r--. 1 mockbuild mock 19805 Nov 21 11:44 gtktools.pyc
-rw-r--r--. 1 mockbuild mock 19766 Nov 21 11:44 gtktools.pyo
drwxr-xr-x. 2 mockbuild mock 4096 Nov 21 11:44 mplot3d
drwxr-xr-x. 3 mockbuild mock 4096 Nov 21 11:44 tests

Expected outcome

Existing __init__.py file in /usr/lib64/python2.7/site-packages/mpl_toolkits/ and running tests.

Matplotlib version

Operating system: Fedora 28 (rawhide)

Matplotlib version: 2.1.0 built from source

Matplotlib backend (print(matplotlib.get_backend())): TkAgg

Python version: 2.7.14 from distribution package

Issue 2:
Bug summary

As of setuptools v67.3.0 the use of pkg_resources.declare_namespace in lib/mpl_toolkits/__init__.py raises a DeprecationWarning.

Code for reproduction

$ mamba create -n test python=3.10 matplotlib-base -y
$ mamba activate test
$ export PYTHONDEVMODE=1
$ python -c "import pkg_resources"

Actual outcome

/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)

Expected outcome

No output

Additional information

See also:

https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages

https://packaging.python.org/en/latest/guides/packaging-namespace-packages/

https://peps.python.org/pep-0420/

Operating system

No response

Matplotlib Version

3.7.0

Matplotlib Backend

TkAgg

Python version

Python 3.10.9

Jupyter version

No response

Installation

conda