8000 Merge pull request #28689 from QuLogic/py313-tests · matplotlib/matplotlib@7a2ea1c · GitHub
[go: up one dir, main page]

Skip to content

Commit 7a2ea1c

Browse files
authored
Merge pull request #28689 from QuLogic/py313-tests
ci: Enable testing on Python 3.13
2 parents 699dd7e + 85b4e02 commit 7a2ea1c

File tree

4 files changed

+52
-6
lines changed

4 files changed

+52
-6
lines changed

.github/workflows/tests.yml

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,19 @@ jobs:
8585
pyqt6-ver: '!=6.6.0'
8686
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
8787
pyside6-ver: '!=6.5.1'
88+
- os: ubuntu-22.04
89+
python-version: '3.13'
90+
# https://www.riverbankcomputing.com/pipermail/pyqt/2023-November/045606.html
91+
pyqt6-ver: '!=6.6.0'
92+
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
93+
pyside6-ver: '!=6.5.1'
94+
- name-suffix: "Free-threaded"
95+
os: ubuntu-22.04
96+
python-version: '3.13t'
97+
# https://www.riverbankcomputing.com/pipermail/pyqt/2023-November/045606.html
98+
pyqt6-ver: '!=6.6.0'
99+
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
100+
pyside6-ver: '!=6.5.1'
88101
- os: macos-12 # This runner is on Intel chips.
89102
python-version: '3.10'
90103
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
@@ -93,6 +106,10 @@ jobs:
93106
python-version: '3.12'
94107
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
95108
pyside6-ver: '!=6.5.1'
109+
- os: macos-14 # This runner is on M1 (arm64) chips.
110+
python-version: '3.13'
111+
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
112+
pyside6-ver: '!=6.5.1'
96113

97114
steps:
98115
- uses: actions/checkout@v4
@@ -101,8 +118,17 @@ jobs:
101118

102119
- name: Set up Python ${{ matrix.python-version }}
103120
uses: actions/setup-python@v5
121+
if: matrix.python-version != '3.13t'
104122
with:
105123
python-version: ${{ matrix.python-version }}
124+
allow-prereleases: true
125+
126+
- name: Set up Python ${{ matrix.python-version }}
127+
uses: deadsnakes/action@6c8b9b82fe0b4344f4b98f2775fcc395df45e494 # v3.1.0
128+
if: matrix.python-version == '3.13t'
129+
with:
130+
python-version: '3.13'
131+
nogil: true
106132

107133
- name: Install OS dependencies
108134
run: |
@@ -149,6 +175,11 @@ jobs:
149175
texlive-luatex \
150176
texlive-pictures \
151177
texlive-xetex
178+
if [[ "${{ matrix.python-version }}" = '3.13t' ]]; then
179+
# TODO: Remove this once setup-python supports nogil distributions.
180+
sudo apt-get install -yy --no-install-recommends \
181+
python3.13-tk-nogil
182+
fi
152183
if [[ "${{ matrix.os }}" = ubuntu-20.04 ]]; then
153184
sudo apt-get install -yy --no-install-recommends libopengl0
154185
else # ubuntu-22.04
@@ -205,6 +236,15 @@ jobs:
205236
4-${{ runner.os }}-py${{ matrix.python-version }}-mpl-${{ github.ref }}-
206237
4-${{ runner.os }}-py${{ matrix.python-version }}-mpl-
207238
239+
- name: Install the nightly dependencies
240+
if: matrix.python-version == '3.13t'
241+
run: |
242+
python -m pip install pytz tzdata python-dateutil # Must be installed for Pandas.
243+
python -m pip install \
244+
--pre \
245+
--index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \
246+
--upgrade --only-binary=:all: numpy pandas pillow contourpy
247+
208248
- name: Install Python dependencies
209249
run: |
210250
# Upgrade pip and setuptools and wheel to get as clean an install as
@@ -230,6 +270,7 @@ jobs:
230270
# Sphinx is needed to run sphinxext tests
231271
python -m pip install --upgrade sphinx!=6.1.2
232272
273+
if [[ "${{ matrix.python-version }}" != '3.13t' ]]; then
233274
# GUI toolkits are pip-installable only for some versions of Python
234275
# so don't fail if we can't install them. Make it easier to check
235276
# whether the install was successful by trying to import the toolkit
@@ -249,11 +290,11 @@ jobs:
249290
python -c 'import PyQt5.QtCore' &&
250291
echo 'PyQt5 is available' ||
251292
echo 'PyQt5 is not available'
252-
# Even though 6D47 PySide2 wheels can be installed on Python 3.12, they are broken and since PySide2 is
293+
# Even though PySide2 wheels can be installed on Python 3.12+, they are broken and since PySide2 is
253294
# deprecated, they are unlikely to be fixed. For the same deprecation reason, there are no wheels
254295
# on M1 macOS, so don't bother there either.
255296
if [[ "${{ matrix.os }}" != 'macos-14'
256-
&& "${{ matrix.python-version }}" != '3.12' ]]; then
297+
&& "${{ matrix.python-version }}" != '3.12' && "${{ matrix.python-version }}" != '3.13' ]]; then
257298
python -mpip install --upgrade pyside2${{ matrix.pyside2-ver }} &&
258299
python -c 'import PySide2.QtCore' &&
259300
echo 'PySide2 is available' ||
@@ -275,6 +316,8 @@ jobs:
275316
echo 'wxPython is available' ||
276317
echo 'wxPython is not available'
277318
319+
fi # Skip backends on Python 3.13t.
320+
278321
- name: Install the nightly dependencies
279322
# Only install the nightly dependencies during the scheduled event
280323
if: github.event_name == 'schedule' && matrix.name-suffix != '(Minimum Versions)'
@@ -313,6 +356,9 @@ jobs:
313356

314357
- name: Run pytest
315358
run: |
359+
if [[ "${{ matrix.python-version }}" == '3.13t' ]]; then
360+
export PYTHON_GIL=0
361+
fi
316362
pytest -rfEsXR -n auto \
317363
--maxfail=50 --timeout=300 --durations=25 \
318364
--cov-report=xml --cov=lib --log-level=DEBUG --color=yes

lib/matplotlib/tests/test_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,7 @@ def test_imshow():
12161216

12171217
@image_comparison(
12181218
['imshow_clip'], style='mpl20',
1219-
tol=1.24 if platform.machine() in ('aarch64', 'ppc64le', 's390x') else 0)
1219+
tol=1.24 if platform.machine() in ('aarch64', 'arm64', 'ppc64le', 's390x') else 0)
12201220
def test_imshow_clip():
12211221
# As originally reported by Gellule Xg <gellule.xg@free.fr>
12221222
# use former defaults to match existing baseline image
@@ -2613,7 +2613,7 @@ def test_contour_hatching():
26132613

26142614
@image_comparison(
26152615
['contour_colorbar'], style='mpl20',
2616-
tol=0.54 if platform.machine() in ('aarch64', 'ppc64le', 's390x') else 0)
2616+
tol=0.54 if platform.machine() in ('aarch64', 'arm64', 'ppc64le', 's390x') else 0)
26172617
def test_contour_colorbar():
26182618
x, y, z = contour_dat()
26192619

lib/matplotlib/tests/test_contour.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ def test_contourf_log_extension(split_collections):
442442
@pytest.mark.parametrize("split_collections", [False, True])
443443
@image_comparison(
444444
['contour_addlines.png'], remove_text=True, style='mpl20',
445-
tol=0.15 if platform.machine() in ('aarch64', 'ppc64le', 's390x')
445+
tol=0.15 if platform.machine() in ('aarch64', 'arm64', 'ppc64le', 's390x')
446446
else 0.03)
447447
# tolerance is because image changed minutely when tick finding on
448448
# colorbars was cleaned up...

lib/mpl_toolkits/mplot3d/tests/test_axes3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def test_bar3d_lightsource():
222222

223223
@mpl3d_image_comparison(
224224
['contour3d.png'], style='mpl20',
225-
tol=0.002 if platform.machine() in ('aarch64', 'ppc64le', 's390x') else 0)
225+
tol=0.002 if platform.machine() in ('aarch64', 'arm64', 'ppc64le', 's390x') else 0)
226226
def test_contour3d():
227227
plt.rcParams['axes3d.automargin'] = True # Remove when image is regenerated
228228
fig = plt.figure()

0 commit comments

Comments
 (0)
0