From c53e850573cea13563ddf5dcaf1cffce6302c465 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 10 Jan 2022 20:22:40 -0500 Subject: [PATCH 1/4] Drop support for Python 3.7 According to NEP 29 [1], Python 3.7 support should be dropped after Dec 26, 2021. As Matplotlib 3.6 will be out a few months from now, it is already time to be dropping 3.7. [1] https://numpy.org/neps/nep-0029-deprecation_policy.html#support-table --- .appveyor.yml | 11 ++++------- .github/workflows/cibuildwheel.yml | 8 ++++---- .github/workflows/tests.yml | 10 +++------- azure-pipelines.yml | 18 +++++++++--------- .../next_api_changes/development/22205-ES.rst | 1 + doc/devel/coding_guide.rst | 4 ++-- doc/devel/dependencies.rst | 2 +- doc/devel/min_dep_policy.rst | 2 +- doc/devel/testing.rst | 4 ++-- lib/matplotlib/tests/test_ticker.py | 5 ++--- requirements/testing/extra.txt | 2 +- setup.py | 11 ++--------- tox.ini | 2 +- 13 files changed, 33 insertions(+), 47 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 5d9dce4bcaa0..91d5a022fd42 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -21,15 +21,12 @@ environment: PINNEDVERS: "pyzmq!=21.0.0,!=22.0.0" matrix: - # In theory we could use a single CONDA_INSTALL_LOCN because we construct - # the envs anyway. But using one for the right python version hopefully - # making things faster due to package caching. - - PYTHON_VERSION: "3.7" - CONDA_INSTALL_LOCN: "C:\\Miniconda37-x64" + - PYTHON_VERSION: "3.8" + CONDA_INSTALL_LOCN: "C:\\Miniconda3-x64" TEST_ALL: "no" EXTRAREQS: "-r requirements/testing/extra.txt" - - PYTHON_VERSION: "3.8" - CONDA_INSTALL_LOCN: "C:\\Miniconda37-x64" + - PYTHON_VERSION: "3.9" + CONDA_INSTALL_LOCN: "C:\\Miniconda3-x64" TEST_ALL: "no" EXTRAREQS: "-r requirements/testing/extra.txt" diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 39b9c46d61a4..ef8d28a25229 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -53,7 +53,7 @@ jobs: - uses: actions/setup-python@v2 name: Install Python with: - python-version: '3.7' + python-version: '3.8' - uses: actions/cache@v2 id: numpy-cache @@ -73,7 +73,7 @@ jobs: cd numpy-${{ env.min-numpy-version }} python -m cibuildwheel --output-dir ../numpy-aarch64-cache env: - CIBW_BUILD: "cp37-* cp38-*" + CIBW_BUILD: "cp38-*" CIBW_ARCHS: aarch64 - name: Build wheels for CPython 3.10 @@ -102,7 +102,7 @@ jobs: run: | python -m cibuildwheel --output-dir dist env: - CIBW_BUILD: "cp37-* cp38-*" + CIBW_BUILD: "cp38-*" CIBW_MANYLINUX_X86_64_IMAGE: manylinux1 CIBW_MANYLINUX_I686_IMAGE: manylinux1 CIBW_BEFORE_BUILD: pip install certifi; pip install --find-links=numpy-aarch64-cache/ numpy==${{ env.min-numpy-version }} @@ -113,7 +113,7 @@ jobs: run: | python -m cibuildwheel --output-dir dist env: - CIBW_BUILD: "pp37-*" + CIBW_BUILD: "pp38-*" CIBW_BEFORE_BUILD: pip install certifi numpy==${{ env.min-numpy-version }} CIBW_ARCHS: ${{ matrix.cibw_archs }} PIP_USE_FEATURE: in-tree-build diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3f2cb2bd7fef..13ae3c8d3322 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,20 +26,16 @@ jobs: include: - name-suffix: "(Minimum Versions)" os: ubuntu-18.04 - python-version: 3.7 + python-version: 3.8 extra-requirements: '-c requirements/testing/minver.txt' - pyqt5-ver: '==5.8 sip==4.19.7' # oldest versions with a Py3.7 wheel. + pyqt5-ver: '==5.11.2 sip==5.0.0' # oldest versions with a Py3.8 wheel. delete-font-cache: true XVFB_RUN: xvfb-run -a - - os: ubuntu-18.04 - python-version: 3.7 - extra-requirements: '-r requirements/testing/extra.txt' - XVFB_RUN: xvfb-run -a - CFLAGS: "-fno-lto" # Ensure that disabling LTO works. - os: ubuntu-18.04 python-version: 3.8 extra-requirements: '-r requirements/testing/extra.txt' XVFB_RUN: xvfb-run -a + CFLAGS: "-fno-lto" # Ensure that disabling LTO works. - os: ubuntu-20.04 python-version: 3.9 extra-requirements: '-r requirements/testing/extra.txt' diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a35e04b34688..3ed2c5233f16 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -38,33 +38,33 @@ stages: - job: Pytest strategy: matrix: - Linux_py37: - vmImage: 'ubuntu-18.04' - python.version: '3.7' Linux_py38: vmImage: 'ubuntu-18.04' python.version: '3.8' Linux_py39: vmImage: 'ubuntu-18.04' python.version: '3.9' - macOS_py37: - vmImage: 'macOS-10.15' - python.version: '3.7' + Linux_py310: + vmImage: 'ubuntu-18.04' + python.version: '3.10' macOS_py38: vmImage: 'macOS-latest' python.version: '3.8' macOS_py39: vmImage: 'macOS-latest' python.version: '3.9' - Windows_py37: - vmImage: 'vs2017-win2016' - python.version: '3.7' + macOS_py310: + vmImage: 'macOS-latest' + python.version: '3.10' Windows_py38: vmImage: 'windows-latest' python.version: '3.8' Windows_py39: vmImage: 'windows-latest' python.version: '3.9' + Windows_py310: + vmImage: 'vs2017-win2016' + python.version: '3.10' maxParallel: 4 pool: vmImage: '$(vmImage)' diff --git a/doc/api/next_api_changes/development/22205-ES.rst b/doc/api/next_api_changes/development/22205-ES.rst index cfd8f5afe271..1e500142c0ff 100644 --- a/doc/api/next_api_changes/development/22205-ES.rst +++ b/doc/api/next_api_changes/development/22205-ES.rst @@ -7,6 +7,7 @@ being bumped: +------------+-----------------+---------------+ | Dependency | min in mpl3.5 | min in mpl3.6 | +============+=================+===============+ +| Python | 3.7 | 3.8 | | NumPy | 1.17 | 1.19 | +------------+-----------------+---------------+ diff --git a/doc/devel/coding_guide.rst b/doc/devel/coding_guide.rst index 2ff18bb8f1f0..cbd2ef8214f3 100644 --- a/doc/devel/coding_guide.rst +++ b/doc/devel/coding_guide.rst @@ -271,11 +271,11 @@ The current active branches are *main* The current development version. Future minor releases (*v3.N.0*) will be - branched from this. Supports Python 3.7+. + branched from this. *v3.N.x* Maintenance branch for Matplotlib 3.N. Future patch releases will be - branched from this. Supports Python 3.6+. + branched from this. *v3.N.M-doc* Documentation for the current release. On a patch release, this will be diff --git a/doc/devel/dependencies.rst b/doc/devel/dependencies.rst index 90cb04c2bff1..98cbca51b7ab 100644 --- a/doc/devel/dependencies.rst +++ b/doc/devel/dependencies.rst @@ -14,7 +14,7 @@ When installing through a package manager like ``pip`` or ``conda``, the mandatory dependencies are automatically installed. This list is mainly for reference. -* `Python `_ (>= 3.7) +* `Python `_ (>= 3.8) * `NumPy `_ (>= 1.19) * `setuptools `_ * `cycler `_ (>= 0.10.0) diff --git a/doc/devel/min_dep_policy.rst b/doc/devel/min_dep_policy.rst index d69fd76c4c03..6f0ec95c7969 100644 --- a/doc/devel/min_dep_policy.rst +++ b/doc/devel/min_dep_policy.rst @@ -83,7 +83,7 @@ specification of the dependencies. ========== ======== ====== Matplotlib Python NumPy ========== ======== ====== -`3.6`_ 3.7 1.19.0 +`3.6`_ 3.8 1.19.0 `3.5`_ 3.7 1.17.0 `3.4`_ 3.7 1.16.0 `3.3`_ 3.6 1.15.0 diff --git a/doc/devel/testing.rst b/doc/devel/testing.rst index 65898b95ee0c..dd98c7a6970a 100644 --- a/doc/devel/testing.rst +++ b/doc/devel/testing.rst @@ -169,7 +169,7 @@ Using tox `Tox `_ is a tool for running tests against multiple Python environments, including multiple versions of Python -(e.g., 3.6, 3.7) and even different Python implementations altogether +(e.g., 3.7, 3.8) and even different Python implementations altogether (e.g., CPython, PyPy, Jython, etc.), as long as all these versions are available on your system's $PATH (consider using your system package manager, e.g. apt-get, yum, or Homebrew, to install them). @@ -186,7 +186,7 @@ You can also run tox on a subset of environments: .. code-block:: bash - $ tox -e py37,py38 + $ tox -e py38,py39 Tox processes everything serially so it can take a long time to test several environments. To speed it up, you might try using a new, diff --git a/lib/matplotlib/tests/test_ticker.py b/lib/matplotlib/tests/test_ticker.py index 5c551a296c3e..24e10c62afbb 100644 --- a/lib/matplotlib/tests/test_ticker.py +++ b/lib/matplotlib/tests/test_ticker.py @@ -908,13 +908,12 @@ def logit_deformatter(string): float 1.41e-4, as '0.5' or as r'$\mathdefault{\frac{1}{2}}$' in float 0.5, """ - # Can inline the Unicode escapes to the raw strings in Python 3.8+ match = re.match( r"[^\d]*" - r"(?P1" "[-\N{Minus Sign}]" r")?" + r"(?P1[-\N{Minus Sign}])?" r"(?P\d*\.?\d*)?" r"(?:\\cdot)?" - r"(?:10\^\{(?P" "[-\N{Minus Sign}]" r"?\d*)})?" + r"(?:10\^\{(?P[-\N{Minus Sign}]?\d*)})?" r"[^\d]*$", string, ) diff --git a/requirements/testing/extra.txt b/requirements/testing/extra.txt index 4582783c743d..e5bb5d86a667 100644 --- a/requirements/testing/extra.txt +++ b/requirements/testing/extra.txt @@ -1,4 +1,4 @@ -# Extra pip requirements for the Python 3.7+ builds +# Extra pip requirements for the Python 3.8+ builds ipykernel nbconvert[execute]!=6.0.0,!=6.0.1 diff --git a/setup.py b/setup.py index 34093ff3ac54..0e39e893c3a8 100644 --- a/setup.py +++ b/setup.py @@ -8,8 +8,8 @@ # and/or pip. import sys -py_min_version = (3, 7) # minimal supported python version -since_mpl_version = (3, 4) # py_min_version is required since this mpl version +py_min_version = (3, 8) # minimal supported python version +since_mpl_version = (3, 6) # py_min_version is required since this mpl version if sys.version_info < py_min_version: error = """ @@ -160,12 +160,6 @@ def prepare_flags(name, enable_lto): return env def build_extensions(self): - # Remove the -Wstrict-prototypes option, it's not valid for C++. Fixed - # in Py3.7 as bpo-5755. - try: - self.compiler.compiler_so.remove('-Wstrict-prototypes') - except (ValueError, AttributeError): - pass if (self.compiler.compiler_type == 'msvc' and os.environ.get('MPL_DISABLE_FH4')): # Disable FH4 Exception Handling implementation so that we don't @@ -289,7 +283,6 @@ def make_release_tree(self, base_dir, files): 'License :: OSI Approved :: Python Software Foundation License', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', diff --git a/tox.ini b/tox.ini index b6b94c41b5fc..fc8479269160 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = py37, py38 +envlist = py38, py39, py310 [testenv] changedir = /tmp From 052bec0ee280135d88f41dcefe25f64778b4b19f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 12 Jan 2022 20:21:34 -0500 Subject: [PATCH 2/4] Clean up NumPy dependencies in wheel CI --- .github/workflows/cibuildwheel.yml | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index ef8d28a25229..84c86682dceb 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -28,8 +28,6 @@ jobs: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} env: - min-numpy-version: "1.17.3" - min-numpy-hash: "b6/d6/be8f975f5322336f62371c9abeb936d592c98c047ad63035f1b38ae08efe" CIBW_ARCHS_MACOS: "x86_64 universal2 arm64" strategy: matrix: @@ -55,27 +53,10 @@ jobs: with: python-version: '3.8' - - uses: actions/cache@v2 - id: numpy-cache - with: - path: numpy-aarch64-cache/ - key: numpy-${{ matrix.cibw_archs }}-cache-${{ env.min-numpy-version }} - - name: Install cibuildwheel run: | python -m pip install cibuildwheel==2.1.1 - - name: Build minimum NumPy for aarch64 - if: matrix.cibw_archs == 'aarch64' && steps.numpy-cache.outputs.cache-hit != 'true' - run: | - wget https://files.pythonhosted.org/packages/${{ env.min-numpy-hash }}/numpy-${{ env.min-numpy-version }}.zip - unzip numpy-${{ env.min-numpy-version }}.zip - cd numpy-${{ env.min-numpy-version }} - python -m cibuildwheel --output-dir ../numpy-aarch64-cache - env: - CIBW_BUILD: "cp38-*" - CIBW_ARCHS: aarch64 - - name: Build wheels for CPython 3.10 run: | python -m cibuildwheel --output-dir dist @@ -83,7 +64,7 @@ jobs: CIBW_BUILD: "cp310-*" CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 CIBW_MANYLINUX_I686_IMAGE: manylinux2014 - CIBW_BEFORE_BUILD: pip install certifi numpy==1.21.3 + CIBW_BEFORE_BUILD: pip install certifi oldest-supported-numpy MPL_DISABLE_FH4: "yes" CIBW_ARCHS: ${{ matrix.cibw_archs }} @@ -94,18 +75,18 @@ jobs: CIBW_BUILD: "cp39-*" CIBW_MANYLINUX_X86_64_IMAGE: manylinux1 CIBW_MANYLINUX_I686_IMAGE: manylinux1 - CIBW_BEFORE_BUILD: pip install certifi numpy==1.19.3 + CIBW_BEFORE_BUILD: pip install certifi oldest-supported-numpy MPL_DISABLE_FH4: "yes" CIBW_ARCHS: ${{ matrix.cibw_archs }} - - name: Build wheels for CPython + - name: Build wheels for CPython 3.8 run: | python -m cibuildwheel --output-dir dist env: CIBW_BUILD: "cp38-*" CIBW_MANYLINUX_X86_64_IMAGE: manylinux1 CIBW_MANYLINUX_I686_IMAGE: manylinux1 - CIBW_BEFORE_BUILD: pip install certifi; pip install --find-links=numpy-aarch64-cache/ numpy==${{ env.min-numpy-version }} + CIBW_BEFORE_BUILD: pip install certifi numpy==1.19.2 MPL_DISABLE_FH4: "yes" CIBW_ARCHS: ${{ matrix.cibw_archs }} @@ -114,7 +95,7 @@ jobs: python -m cibuildwheel --output-dir dist env: CIBW_BUILD: "pp38-*" - CIBW_BEFORE_BUILD: pip install certifi numpy==${{ env.min-numpy-version }} + CIBW_BEFORE_BUILD: pip install certifi oldest-supported-numpy CIBW_ARCHS: ${{ matrix.cibw_archs }} PIP_USE_FEATURE: in-tree-build if: matrix.cibw_archs != 'aarch64' From 934d1ece5d3fa71e3bde3b03a957d12e6f8238cf Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 13 Jan 2022 16:08:34 -0500 Subject: [PATCH 3/4] Temporarily disable PyPy wheels This is supported by the latest cibuildwheel, but using that breaks Windows builds, so I'll look into that separately. --- .github/workflows/cibuildwheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 84c86682dceb..c56f2596f512 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -98,7 +98,7 @@ jobs: CIBW_BEFORE_BUILD: pip install certifi oldest-supported-numpy CIBW_ARCHS: ${{ matrix.cibw_archs }} PIP_USE_FEATURE: in-tree-build - if: matrix.cibw_archs != 'aarch64' + if: false && matrix.cibw_archs != 'aarch64' - name: Validate that LICENSE files are included in wheels run: | From e80631762b4cf3e94414e37e49b6f0a6e9d0a65b Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 13 Jan 2022 14:18:33 -0500 Subject: [PATCH 4/4] TST: bump minimum pillow to 6.2.1 because it has wheels for py38 We need wheels to get webp support (which we test). --- requirements/testing/minver.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/testing/minver.txt b/requirements/testing/minver.txt index ca07c883d586..30b8124b5bec 100644 --- a/requirements/testing/minver.txt +++ b/requirements/testing/minver.txt @@ -4,7 +4,7 @@ cycler==0.10 kiwisolver==1.0.1 numpy==1.19.0 packaging==20.0 -pillow==6.2.0 +pillow==6.2.1 pyparsing==2.2.1 python-dateutil==2.7 fonttools==4.22.0