Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bump minimum Python to 3.10 #28503

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

Merged
merged 1 commit into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ commands:
#

jobs:
docs-python39:
docs-python310:
docker:
- image: cimg/python:3.9
- image: cimg/python:3.10
resource_class: large
steps:
- checkout
Expand Down Expand Up @@ -259,4 +259,4 @@ workflows:
jobs:
# NOTE: If you rename this job, then you must update the `if` condition
# and `circleci-jobs` option in `.github/workflows/circleci.yml`.
- docs-python39
- docs-python310
14 changes: 3 additions & 11 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: 3.9
python-version: '3.10'

# Something changed somewhere that prevents the downloaded-at-build-time
# licenses from being included in built wheels, so pre-download them so
Expand Down Expand Up @@ -158,22 +158,14 @@ jobs:
CIBW_BUILD: "cp310-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}

- name: Build wheels for CPython 3.9
uses: pypa/cibuildwheel@7e5a838a63ac8128d71ab2dfd99e4634dd1bca09 # v2.19.2
with:
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
env:
CIBW_BUILD: "cp39-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}

- name: Build wheels for PyPy
uses: pypa/cibuildwheel@7e5a838a63ac8128d71ab2dfd99e4634dd1bca09 # v2.19.2
with:
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
env:
CIBW_BUILD: "pp39-*"
CIBW_BUILD: "pp310-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}
if: matrix.cibw_archs != 'aarch64'
if: matrix.cibw_archs != 'aarch64' && matrix.os != 'windows-latest'

- uses: actions/upload-artifact@v4
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/circleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: "CircleCI artifact handling"
on: [status]
jobs:
circleci_artifacts_redirector_job:
if: "${{ github.event.context == 'ci/circleci: docs-python39' }}"
if: "${{ github.event.context == 'ci/circleci: docs-python310' }}"
permissions:
statuses: write
runs-on: ubuntu-latest
Expand All @@ -16,11 +16,11 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
api-token: ${{ secrets.CIRCLECI_TOKEN }}
artifact-path: 0/doc/build/html/index.html
circleci-jobs: docs-python39
circleci-jobs: docs-python310
job-title: View the built docs

post_warnings_as_review:
if: "${{ github.event.context == 'ci/circleci: docs-python39' }}"
if: "${{ github.event.context == 'ci/circleci: docs-python310' }}"
permissions:
contents: read
checks: write
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/cygwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ jobs:
test-cygwin:
runs-on: windows-latest
name: Python 3.${{ matrix.python-minor-version }} on Cygwin
# Enable these when Cygwin has Python 3.12.
if: >-
github.event_name == 'workflow_dispatch' ||
github.event_name == 'schedule' ||
(false && github.event_name == 'schedule') ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to keep the false here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

answer: yes, cygwin is skipping 3.10 and 3.11, but is not ready for 3.12, so will be re-enabled later

(
false &&
github.repository == 'matplotlib/matplotlib' &&
!contains(github.event.head_commit.message, '[ci skip]') &&
!contains(github.event.head_commit.message, '[skip ci]') &&
Expand All @@ -72,7 +74,7 @@ jobs:
)
strategy:
matrix:
python-minor-version: [9]
python-minor-version: [12]

steps:
- name: Fix line endings
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/mypy-stubtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: '3.10'

- name: Set up reviewdog
uses: reviewdog/action-setup@v1
Expand All @@ -30,7 +30,7 @@ jobs:
run: |
set -o pipefail
tox -e stubtest | \
sed -e "s!.tox/stubtest/lib/python3.9/site-packages!lib!g" | \
sed -e "s!.tox/stubtest/lib/python3.10/site-packages!lib!g" | \
reviewdog \
-efm '%Eerror: %m' \
-efm '%CStub: in file %f:%l' \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: '3.10'

- name: Install flake8
run: pip3 install -r requirements/testing/flake8.txt
Expand All @@ -42,7 +42,7 @@ jobs:
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: '3.10'

- name: Install mypy
run: pip3 install -r requirements/testing/mypy.txt -r requirements/testing/all.txt
Expand Down
31 changes: 14 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,28 @@ jobs:
include:
- name-suffix: "(Minimum Versions)"
os: ubuntu-20.04
python-version: 3.9
python-version: '3.10'
extra-requirements: '-c requirements/testing/minver.txt'
pyqt5-ver: '==5.12.2 sip==5.0.0' # oldest versions with a Py3.9 wheel.
pyqt6-ver: '==6.1.0 PyQt6-Qt6==6.1.0'
pyside2-ver: '==5.15.1' # oldest version with working Py3.9 wheel.
pyside6-ver: '==6.0.0'
delete-font-cache: true
# Oldest versions with Py3.10 wheels.
pyqt5-ver: '==5.15.5 sip==6.3.0'
pyqt6-ver: '==6.2.0 PyQt6-Qt6==6.2.0'
pyside2-ver: '==5.15.2.1'
pyside6-ver: '==6.2.0'
- os: ubuntu-20.04
python-version: 3.9
python-version: '3.10'
# One CI run tests ipython/matplotlib-inline before backend mapping moved to mpl
extra-requirements: '-r requirements/testing/extra.txt "ipython==7.19" "matplotlib-inline<0.1.7"'
extra-requirements:
-r requirements/testing/extra.txt
"ipython==7.29.0"
"ipykernel==5.5.6"
"matplotlib-inline<0.1.7"
CFLAGS: "-fno-lto" # Ensure that disabling LTO works.
# https://github.com/matplotlib/matplotlib/pull/26052#issuecomment-1574595954
# https://www.riverbankcomputing.com/pipermail/pyqt/2023-November/045606.html
pyqt6-ver: '!=6.5.1,!=6.6.0'
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
pyside6-ver: '!=6.5.1'
- os: ubuntu-20.04
python-version: '3.10'
extra-requirements: '-r requirements/testing/extra.txt'
# https://github.com/matplotlib/matplotlib/pull/26052#issuecomment-1574595954
# https://www.riverbankcomputing.com/pipermail/pyqt/2023-November/045606.html
pyqt6-ver: '!=6.5.1,!=6.6.0'
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
pyside6-ver: '!=6.5.1'
- os: ubuntu-22.04
python-version: '3.11'
# https://www.riverbankcomputing.com/pipermail/pyqt/2023-November/045606.html
Expand All @@ -88,8 +85,8 @@ jobs:
pyqt6-ver: '!=6.6.0'
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
pyside6-ver: '!=6.5.1'
- os: macos-12 # This runnre is on Intel chips.
python-version: 3.9
- os: macos-12 # This runner is on Intel chips.
python-version: '3.10'
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
pyside6-ver: '!=6.5.1'
- os: macos-14 # This runner is on M1 (arm64) chips.
Expand Down
13 changes: 2 additions & 11 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,20 @@ stages:
- job: Pytest
strategy:
matrix:
Linux_py39:
vmImage: 'ubuntu-20.04' # keep one job pinned to the oldest image
python.version: '3.9'
Linux_py310:
vmImage: 'ubuntu-latest'
vmImage: 'ubuntu-20.04' # keep one job pinned to the oldest image
python.version: '3.10'
Linux_py311:
vmImage: 'ubuntu-latest'
python.version: '3.11'
macOS_py39:
vmImage: 'macOS-latest'
python.version: '3.9'
macOS_py310:
vmImage: 'macOS-latest'
python.version: '3.10'
macOS_py311:
vmImage: 'macOS-latest'
python.version: '3.11'
Windows_py39:
vmImage: 'windows-2019' # keep one job pinned to the oldest image
python.version: '3.9'
Windows_py310:
vmImage: 'windows-latest'
vmImage: 'windows-2019' # keep one job pinned to the oldest image
python.version: '3.10'
Windows_py311:
vmImage: 'windows-latest'
Expand Down
14 changes: 14 additions & 0 deletions doc/api/next_api_changes/development/28503-ES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Increase to minimum supported versions of dependencies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For Matplotlib 3.10, the :ref:`minimum supported versions <dependencies>` are
being bumped:

+------------+-----------------+----------------+
| Dependency | min in mpl3.9 | min in mpl3.10 |
+============+=================+================+
| Python | 3.9 | 3.10 |
+------------+-----------------+----------------+

This is consistent with our :ref:`min_deps_policy` and `SPEC0
<https://scientific-python.org/specs/spec-0000/>`__
4 changes: 2 additions & 2 deletions doc/devel/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ Using tox

`Tox <https://tox.readthedocs.io/en/latest/>`_ is a tool for running tests
against multiple Python environments, including multiple versions of Python
(e.g., 3.7, 3.8) and even different Python implementations altogether
(e.g., 3.10, 3.11) 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).
Expand All @@ -269,7 +269,7 @@ You can also run tox on a subset of environments:

.. code-block:: bash

$ tox -e py38,py39
$ tox -e py310,py311

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,
Expand Down
4 changes: 1 addition & 3 deletions doc/install/dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ When installing through a package manager like ``pip`` or ``conda``, the
mandatory dependencies are automatically installed. This list is mainly for
reference.

* `Python <https://www.python.org/downloads/>`_ (>= 3.9)
* `Python <https://www.python.org/downloads/>`_ (>= 3.10)
* `contourpy <https://pypi.org/project/contourpy/>`_ (>= 1.0.1)
* `cycler <https://matplotlib.org/cycler/>`_ (>= 0.10.0)
* `dateutil <https://pypi.org/project/python-dateutil/>`_ (>= 2.7)
Expand All @@ -30,8 +30,6 @@ reference.
* `packaging <https://pypi.org/project/packaging/>`_ (>= 20.0)
* `Pillow <https://pillow.readthedocs.io/en/latest/>`_ (>= 8.0)
* `pyparsing <https://pypi.org/project/pyparsing/>`_ (>= 2.3.1)
* `importlib-resources <https://pypi.org/project/importlib-resources/>`_
(>= 3.2.0; only required on Python < 3.10)


.. _optional_dependencies:
Expand Down
4 changes: 2 additions & 2 deletions doc/install/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,9 @@ at the Terminal.app command line::

You should see something like ::

3.6.0 /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/matplotlib/__init__.py
3.10.0 /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/matplotlib/__init__.py

where ``3.6.0`` is the Matplotlib version you just installed, and the path
where ``3.10.0`` is the Matplotlib version you just installed, and the path
following depends on whether you are using Python.org Python, Homebrew or
Macports. If you see another version, or you get an error like ::

Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies:
- pygobject
- pyparsing>=2.3.1
- pyqt
- python>=3.10
- python-dateutil>=2.1
- setuptools_scm
- wxpython
Expand Down
4 changes: 2 additions & 2 deletions galleries/users_explain/customizing.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ def plotting_function():
#
# 4. :file:`{INSTALL}/matplotlib/mpl-data/matplotlibrc`, where
# :file:`{INSTALL}` is something like
# :file:`/usr/lib/python3.9/site-packages` on Linux, and maybe
# :file:`C:\\Python39\\Lib\\site-packages` on Windows. Every time you
# :file:`/usr/lib/python3.10/site-packages` on Linux, and maybe
# :file:`C:\\Python310\\Lib\\site-packages` on Windows. Every time you
# install matplotlib, this file will be overwritten, so if you want
# your customizations to be saved, please move this file to your
# user-specific matplotlib directory.
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/_api/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections.abc import Callable, Generator, Mapping, Sequence
from typing import Any, Iterable, TypeVar, overload
from typing_extensions import Self # < Py 3.11

from numpy.typing import NDArray

Expand All @@ -25,9 +26,8 @@ class classproperty(Any):
fdel: None = ...,
doc: str | None = None,
): ...
# Replace return with Self when py3.9 is dropped
@overload
def __get__(self, instance: None, owner: None) -> classproperty: ...
def __get__(self, instance: None, owner: None) -> Self: ...
@overload
def __get__(self, instance: object, owner: type[object]) -> Any: ...
@property
Expand Down
3 changes: 1 addition & 2 deletions lib/matplotlib/_api/deprecation.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from collections.abc import Callable
import contextlib
from typing import Any, TypedDict, TypeVar, overload
from typing import Any, ParamSpec, TypedDict, TypeVar, overload
from typing_extensions import (
ParamSpec, # < Py 3.10
Unpack, # < Py 3.11
)

Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/axis.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from collections.abc import Callable, Iterable, Sequence
import datetime
from typing import Any, Literal, overload
from typing_extensions import Self # < Py 3.11

import numpy as np
from numpy.typing import ArrayLike
Expand Down Expand Up @@ -93,9 +94,8 @@ class Ticker:

class _LazyTickList:
def __init__(self, major: bool) -> None: ...
# Replace return with Self when py3.9 is dropped
@overload
def __get__(self, instance: None, owner: None) -> _LazyTickList: ...
def __get__(self, instance: None, owner: None) -> Self: ...
@overload
def __get__(self, instance: Axis, owner: type[Axis]) -> list[Tick]: ...

Expand Down
10 changes: 2 additions & 8 deletions lib/matplotlib/backends/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,8 @@ def _read_entry_points(self):
# [project.entry-points."matplotlib.backend"]
# inline = "matplotlib_inline.backend_inline"
import importlib.metadata as im
import sys

# entry_points group keyword not available before Python 3.10
group = "matplotlib.backend"
if sys.version_info >= (3, 10):
entry_points = im.entry_points(group=group)
else:
entry_points = im.entry_points().get(group, ())

entry_points = im.entry_points(group="matplotlib.backend")
entries = [(entry.name, entry.value) for entry in entry_points]

# For backward compatibility, if matplotlib-inline and/or ipympl are installed
Expand Down
7 changes: 3 additions & 4 deletions lib/matplotlib/dviread.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ from enum import Enum
from collections.abc import Generator

from typing import NamedTuple
from typing_extensions import Self # < Py 3.11

class _dvistate(Enum):
pre: int
Expand Down Expand Up @@ -47,8 +48,7 @@ class Dvi:
fonts: dict[int, DviFont]
state: _dvistate
def __init__(self, filename: str | os.PathLike, dpi: float | None) -> None: ...
# Replace return with Self when py3.9 is dropped
def __enter__(self) -> Dvi: ...
def __enter__(self) -> Self: ...
def __exit__(self, etype, evalue, etrace) -> None: ...
def __iter__(self) -> Generator[Page, None, None]: ...
def close(self) -> None: ...
Expand Down Expand Up @@ -83,8 +83,7 @@ class PsFont(NamedTuple):
filename: str

class PsfontsMap:
# Replace return with Self when py3.9 is dropped
def __new__(cls, filename: str | os.PathLike) -> PsfontsMap: ...
def __new__(cls, filename: str | os.PathLike) -> Self: ...
def __getitem__(self, texname: bytes) -> PsFont: ...

def find_tex_file(filename: str | os.PathLike) -> str: ...
Loading
Loading