Skip to content
Open
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
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ environment:
--cov-report= --cov=lib --log-level=DEBUG

matrix:
- PYTHON_VERSION: "3.11"
- PYTHON_VERSION: "3.12"

# We always use a 64-bit machine, but can build x86 distributions
# with the PYTHON_ARCH variable
Expand Down
20 changes: 1 addition & 19 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
name: Install Python
with:
python-version: '3.11'
python-version: '3.12'

# 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 @@ -176,24 +176,6 @@ jobs:
CIBW_BUILD: "cp312-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}

- name: Build wheels for CPython 3.11
uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
with:
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
env:
CIBW_BUILD: "cp311-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}

- name: Build wheels for PyPy
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

According to the docs PyPy wheels only go up to py311. Should we add GraalPy instead, or do we just wait till someone asks for it?

uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
with:
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
env:
CIBW_BUILD: "pp311-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}
CIBW_ENABLE: pypy
if: matrix.cibw_archs != 'aarch64' && matrix.os != 'windows-latest' && matrix.os != 'windows-11-arm'

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: cibw-wheels-${{ runner.os }}-${{ matrix.cibw_archs }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Set up Python 3
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'
python-version: '3.12'

- name: Install ruff
run: pip3 install ruff
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Set up Python 3
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'
python-version: '3.12'

- name: Install mypy
run: pip3 install --group build --group typing
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 @@ -19,7 +19,7 @@ jobs:
- name: Set up Python 3
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'
python-version: '3.12'

- name: Set up reviewdog
uses: reviewdog/action-setup@d8a7baabd7f3e8544ee4dbde3ee41d0011c3a93f # v1.5.0
Expand All @@ -33,7 +33,7 @@ jobs:
run: |
set -o pipefail
tox -e stubtest | \
sed -e "s!.tox/stubtest/lib/python3.11/site-packages!lib!g" | \
sed -e "s!.tox/stubtest/lib/python3.12/site-packages!lib!g" | \
reviewdog \
-efm '%Eerror: %m' \
-efm '%CStub: in file %f:%l' \
Expand Down
20 changes: 2 additions & 18 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ jobs:
include:
- name-suffix: "(Minimum Versions)"
os: ubuntu-22.04
python-version: '3.11'
python-version: '3.12'
extra-requirements: '-c ci/minver-requirements.txt'
delete-font-cache: true
# https://github.com/matplotlib/matplotlib/issues/29844
pygobject-ver: '<3.52.0'
- os: ubuntu-22.04
python-version: '3.11'
python-version: '3.12'
CFLAGS: "-fno-lto" # Ensure that disabling LTO works.
extra-requirements: '--group test-extra'
# https://github.com/matplotlib/matplotlib/issues/29844
Expand All @@ -73,16 +73,10 @@ jobs:
python-version: '3.13t'
# https://github.com/matplotlib/matplotlib/issues/29844
pygobject-ver: '<3.52.0'
- os: ubuntu-24.04
python-version: '3.12'
- os: ubuntu-24.04
python-version: '3.14'
- os: ubuntu-24.04-arm
python-version: '3.12'
- os: macos-14 # This runner is on M1 (arm64) chips.
python-version: '3.11'
# https://github.com/matplotlib/matplotlib/issues/29732
pygobject-ver: '<3.52.0'
- os: macos-14 # This runner is on M1 (arm64) chips.
python-version: '3.12'
# https://github.com/matplotlib/matplotlib/issues/29732
Expand Down Expand Up @@ -267,16 +261,6 @@ jobs:
echo 'PyQt5 is available' ||
echo 'PyQt5 is not available'
fi
# Even though PySide2 wheels can be installed on Python 3.12+, they are broken and since PySide2 is
# deprecated, they are unlikely to be fixed. For the same deprecation reason, there are no wheels
# on M1 macOS, so don't bother there either.
if [[ "${{ matrix.os }}" != 'macos-14' && "${{ matrix.python-version }}" == '3.11'
]]; then
python -mpip install --upgrade pyside2 &&
python -c 'import PySide2.QtCore' &&
echo 'PySide2 is available' ||
echo 'PySide2 is not available'
fi
python -mpip install --upgrade --only-binary :all: pyqt6 &&
python -c 'import PyQt6.QtCore' &&
echo 'PyQt6 is available' ||
Expand Down
5 changes: 1 addition & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,8 @@ stages:
- job: Pytest
strategy:
matrix:
Windows_py311:
vmImage: 'windows-2022' # Keep one job pinned to the oldest image
python.version: '3.11'
Windows_py312:
vmImage: 'windows-latest'
vmImage: 'windows-2022' # Keep one job pinned to the oldest image
python.version: '3.12'
Windows_py313:
vmImage: 'windows-latest'
Expand Down
4 changes: 2 additions & 2 deletions ci/minver-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Extra pip requirements for the minimum-version CI run

contourpy==1.0.1
contourpy==1.2.1
cycler==0.10
fonttools==4.22.0
importlib-resources==3.2.0
kiwisolver==1.3.2
meson-python==0.13.2
meson==1.1.0
numpy==1.25.0
numpy==2.0.0
packaging==20.0
pillow==9.0.1
pyparsing==3.0.0
Expand Down
1 change: 1 addition & 0 deletions doc/devel/min_dep_policy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ specification of the dependencies.
========== ======== ======
Matplotlib Python NumPy
========== ======== ======
3.12 3.12 2.0.0
3.11 3.11 1.25.0
`3.10`_ 3.10 1.23.0
`3.9`_ 3.9 1.23.0
Expand Down
2 changes: 1 addition & 1 deletion doc/devel/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ You can also run tox on a subset of environments:

.. code-block:: bash
$ tox -e py310,py311
$ tox -e py312,py314
Tox processes environments sequentially by default,
which can be slow when testing multiple environments.
Expand Down
6 changes: 3 additions & 3 deletions doc/install/dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ 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.11)
* `contourpy <https://pypi.org/project/contourpy/>`_ (>= 1.0.1)
* `Python <https://www.python.org/downloads/>`_ (>= 3.12)
* `contourpy <https://pypi.org/project/contourpy/>`_ (>= 1.2.1)
* `cycler <https://matplotlib.org/cycler/>`_ (>= 0.10.0)
* `dateutil <https://pypi.org/project/python-dateutil/>`_ (>= 2.7)
* `fontTools <https://fonttools.readthedocs.io/en/latest/>`_ (>= 4.22.0)
* `kiwisolver <https://github.com/nucleic/kiwi>`_ (>= 1.3.1)
* `NumPy <https://numpy.org>`_ (>= 1.25)
* `NumPy <https://numpy.org>`_ (>= 2.0)
* `packaging <https://pypi.org/project/packaging/>`_ (>= 20.0)
* `Pillow <https://pillow.readthedocs.io/en/latest/>`_ (>= 9.0)
* `pyparsing <https://pypi.org/project/pyparsing/>`_ (>= 3)
Expand Down
6 changes: 3 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ dependencies:
- cairocffi
- c-compiler
- cxx-compiler
- contourpy>=1.0.1
- contourpy>=1.2.1
- cycler>=0.10.0
- fonttools>=4.22.0
- importlib-resources>=3.2.0
- kiwisolver>=1.3.1
- pybind11>=2.13.2
- meson-python>=0.13.1
- numpy>=1.25
- numpy>=2.0
- pillow>=9
- pkg-config
- pygobject
- pyparsing>=3
- pyqt
- python>=3.11
- python>=3.12
- python-dateutil>=2.1
- setuptools_scm<10
- wxpython
Expand Down
7 changes: 2 additions & 5 deletions galleries/examples/units/basic_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import itertools
import math

from packaging.version import parse as parse_version

import numpy as np

import matplotlib.ticker as ticker
Expand Down Expand Up @@ -170,9 +168,8 @@ def __str__(self):
def __len__(self):
return len(self.value)

if parse_version(np.__version__) >= parse_version('1.20'):
def __getitem__(self, key):
return TaggedValue(self.value[key], self.unit)
def __getitem__(self, key):
return TaggedValue(self.value[key], self.unit)

def __iter__(self):
# Return a generator expression rather than use `yield`, so that
Expand Down
30 changes: 6 additions & 24 deletions lib/matplotlib/_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
import functools
import itertools
import pathlib
import re
import sys
import warnings

from .deprecation import ( # noqa: F401
Expand Down Expand Up @@ -470,25 +468,9 @@ def warn_external(message, category=None):
warnings.warn`` (or ``functools.partial(warnings.warn, stacklevel=2)``,
etc.).
"""
kwargs = {}
if sys.version_info[:2] >= (3, 12):
# Go to Python's `site-packages` or `lib` from an editable install.
basedir = pathlib.Path(__file__).parents[2]
kwargs['skip_file_prefixes'] = (str(basedir / 'matplotlib'),
str(basedir / 'mpl_toolkits'))
else:
frame = sys._getframe()
for stacklevel in itertools.count(1):
if frame is None:
# when called in embedded context may hit frame is None
kwargs['stacklevel'] = stacklevel
break
if not re.match(r"\A(matplotlib|mpl_toolkits)(\Z|\.(?!tests\.))",
# Work around sphinx-gallery not setting __name__.
frame.f_globals.get("__name__", "")):
kwargs['stacklevel'] = stacklevel
break
frame = frame.f_back
# preemptively break reference cycle between locals and the frame
del frame
warnings.warn(message, category, **kwargs)
# Go to Python's `site-packages` or `lib` from an editable install.
basedir = pathlib.Path(__file__).parents[2]
skip_file_prefixes = (str(basedir / 'matplotlib'),
str(basedir / 'mpl_toolkits'))

warnings.warn(message, category, skip_file_prefixes=skip_file_prefixes)
5 changes: 1 addition & 4 deletions lib/matplotlib/_api/deprecation.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from collections.abc import Callable
import contextlib
from typing import Any, Literal, ParamSpec, TypedDict, TypeVar, overload
from typing_extensions import (
Unpack, # < Py 3.11
)
from typing import Any, Literal, ParamSpec, TypedDict, TypeVar, Unpack, overload

_P = ParamSpec("_P")
_R = TypeVar("_R")
Expand Down
9 changes: 3 additions & 6 deletions lib/matplotlib/ft2font.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from collections.abc import Buffer
from enum import Enum, Flag
from os import PathLike
import sys
from typing import BinaryIO, Literal, NewType, NotRequired, TypeAlias, TypedDict, cast, final, overload
from typing_extensions import Buffer # < Py 3.12

import numpy as np
from numpy.typing import NDArray
Expand Down Expand Up @@ -242,8 +241,7 @@ class FT2Font(Buffer):
_kerning_factor: int | None = ...,
_warn_if_used: bool = ...,
) -> None: ...
if sys.version_info[:2] >= (3, 12):
def __buffer__(self, /, flags: int) -> memoryview: ...
def __buffer__(self, flags: int, /) -> memoryview: ...
def _layout(
self,
text: str,
Expand Down Expand Up @@ -348,8 +346,7 @@ class FT2Font(Buffer):
class FT2Image(Buffer):
def __init__(self, width: int, height: int) -> None: ...
def draw_rect_filled(self, x0: int, y0: int, x1: int, y1: int) -> None: ...
if sys.version_info[:2] >= (3, 12):
def __buffer__(self, /, flags: int) -> memoryview: ...
def __buffer__(self, flags: int, /) -> memoryview: ...

@final
class Glyph:
Expand Down
3 changes: 0 additions & 3 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1609,9 +1609,6 @@ def test_pcolor_log_scale(fig_test, fig_ref):
when using pcolor.
"""
x = np.linspace(0, 1, 11)
# Ensuring second x value always falls slightly above 0.1 prevents flakiness with
# numpy v1 #30882. This can be removed once we require numpy >= 2.
x[1] += 0.00001
y = np.linspace(1, 2, 5)
X, Y = np.meshgrid(x, y)
C = X[:-1, :-1] + Y[:-1, :-1]
Expand Down
13 changes: 0 additions & 13 deletions lib/matplotlib/tests/test_backends_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,6 @@ def _test_thread_impl():
reason='PyPy does not support Tkinter threading: '
'https://foss.heptapod.net/pypy/pypy/-/issues/1929',
strict=True))
elif (backend == 'tkagg' and
('TF_BUILD' in os.environ or 'GITHUB_ACTION' in os.environ) and
sys.platform == 'darwin' and sys.version_info[:2] < (3, 11)):
param.marks.append( # https://github.com/actions/setup-python/issues/649
pytest.mark.xfail('Tk version mismatch on Azure macOS CI'))


@pytest.mark.parametrize("env", _thread_safe_backends)
Expand Down Expand Up @@ -610,14 +605,6 @@ def _test_number_of_draws_script():
elif backend == "wx":
param.marks.append(
pytest.mark.skip("wx does not support blitting"))
elif (backend == 'tkagg' and
('TF_BUILD' in os.environ or 'GITHUB_ACTION' in os.environ) and
sys.platform == 'darwin' and
sys.version_info[:2] < (3, 11)
):
param.marks.append( # https://github.com/actions/setup-python/issues/649
pytest.mark.xfail('Tk version mismatch on Azure macOS CI')
)


@pytest.mark.parametrize("env", _blit_backends)
Expand Down
18 changes: 7 additions & 11 deletions lib/matplotlib/tests/test_cbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,17 +643,13 @@ def get_a(self): return None
def test_warn_external(recwarn):
_api.warn_external("oops")
assert len(recwarn) == 1
if sys.version_info[:2] >= (3, 12):
# With Python 3.12, we let Python figure out the stacklevel using the
# `skip_file_prefixes` argument, which cannot exempt tests, so just confirm
# the filename is not in the package.
basedir = pathlib.Path(__file__).parents[2]
assert not recwarn[0].filename.startswith((str(basedir / 'matplotlib'),
str(basedir / 'mpl_toolkits')))
else:
# On older Python versions, we manually calculated the stacklevel, and had an
# exception for our own tests.
assert recwarn[0].filename == __file__
# Since Python 3.12, we let Python figure out the stacklevel using the
# `skip_file_prefixes` argument, which cannot exempt tests, so just confirm
# the filename is not in the package.
basedir = pathlib.Path(__file__).parents[2]
assert not recwarn[0].filename.startswith((str(basedir / 'matplotlib'),
str(basedir / 'mpl_toolkits')))



def test_warn_external_frame_embedded_python():
Expand Down
4 changes: 1 addition & 3 deletions lib/matplotlib/tests/test_contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from matplotlib.colors import LogNorm, same_color
import matplotlib.patches as mpatches
from matplotlib.testing.decorators import check_figures_equal, image_comparison
from packaging.version import parse as parse_version
import pytest


Expand Down Expand Up @@ -257,8 +256,7 @@ def test_contour_datetime_axis():

@image_comparison(['contour_test_label_transforms.png'],
remove_text=True, style='mpl20',
tol=1 if parse_version(np.version.version).major < 2 else
0 if platform.machine() == 'x86_64' else 0.005)
tol=0 if platform.machine() == 'x86_64' else 0.005)
def test_labels():
# Adapted from pylab_examples example code: contour_demo.py
# see issues #2475, #2843, and #2818 for explanation
Expand Down
Loading
Loading