Skip to content

Commit f9e8f77

Browse files
committed
MNT: bump minimum numpy to 2.0
1 parent 66e9cc8 commit f9e8f77

10 files changed

Lines changed: 17 additions & 30 deletions

File tree

ci/minver-requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Extra pip requirements for the minimum-version CI run
22

3-
contourpy==1.0.1
3+
contourpy==1.2.1
44
cycler==0.10
55
fonttools==4.22.0
66
importlib-resources==3.2.0
77
kiwisolver==1.3.2
88
meson-python==0.13.2
99
meson==1.1.0
10-
numpy==1.25.0
10+
numpy==2.0.0
1111
packaging==20.0
1212
pillow==9.0.1
1313
pyparsing==3.0.0

doc/devel/min_dep_policy.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ specification of the dependencies.
115115
========== ======== ======
116116
Matplotlib Python NumPy
117117
========== ======== ======
118-
3.12 3.12 1.25.0
118+
3.12 3.12 2.0.0
119119
3.11 3.11 1.25.0
120120
`3.10`_ 3.10 1.23.0
121121
`3.9`_ 3.9 1.23.0

doc/install/dependencies.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ mandatory dependencies are automatically installed. This list is mainly for
2121
reference.
2222

2323
* `Python <https://www.python.org/downloads/>`_ (>= 3.12)
24-
* `contourpy <https://pypi.org/project/contourpy/>`_ (>= 1.0.1)
24+
* `contourpy <https://pypi.org/project/contourpy/>`_ (>= 1.2.1)
2525
* `cycler <https://matplotlib.org/cycler/>`_ (>= 0.10.0)
2626
* `dateutil <https://pypi.org/project/python-dateutil/>`_ (>= 2.7)
2727
* `fontTools <https://fonttools.readthedocs.io/en/latest/>`_ (>= 4.22.0)
2828
* `kiwisolver <https://github.com/nucleic/kiwi>`_ (>= 1.3.1)
29-
* `NumPy <https://numpy.org>`_ (>= 1.25)
29+
* `NumPy <https://numpy.org>`_ (>= 2.0)
3030
* `packaging <https://pypi.org/project/packaging/>`_ (>= 20.0)
3131
* `Pillow <https://pillow.readthedocs.io/en/latest/>`_ (>= 9.0)
3232
* `pyparsing <https://pypi.org/project/pyparsing/>`_ (>= 3)

environment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ dependencies:
1313
- cairocffi
1414
- c-compiler
1515
- cxx-compiler
16-
- contourpy>=1.0.1
16+
- contourpy>=1.2.1
1717
- cycler>=0.10.0
1818
- fonttools>=4.22.0
1919
- importlib-resources>=3.2.0
2020
- kiwisolver>=1.3.1
2121
- pybind11>=2.13.2
2222
- meson-python>=0.13.1
23-
- numpy>=1.25
23+
- numpy>=2.0
2424
- pillow>=9
2525
- pkg-config
2626
- pygobject

galleries/examples/units/basic_units.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
import itertools
1919
import math
2020

21-
from packaging.version import parse as parse_version
22-
2321
import numpy as np
2422

2523
import matplotlib.ticker as ticker
@@ -170,9 +168,8 @@ def __str__(self):
170168
def __len__(self):
171169
return len(self.value)
172170

173-
if parse_version(np.__version__) >= parse_version('1.20'):
174-
def __getitem__(self, key):
175-
return TaggedValue(self.value[key], self.unit)
171+
def __getitem__(self, key):
172+
return TaggedValue(self.value[key], self.unit)
176173

177174
def __iter__(self):
178175
# Return a generator expression rather than use `yield`, so that

lib/matplotlib/tests/test_axes.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,9 +1609,6 @@ def test_pcolor_log_scale(fig_test, fig_ref):
16091609
when using pcolor.
16101610
"""
16111611
x = np.linspace(0, 1, 11)
1612-
# Ensuring second x value always falls slightly above 0.1 prevents flakiness with
1613-
# numpy v1 #30882. This can be removed once we require numpy >= 2.
1614-
x[1] += 0.00001
16151612
y = np.linspace(1, 2, 5)
16161613
X, Y = np.meshgrid(x, y)
16171614
C = X[:-1, :-1] + Y[:-1, :-1]

lib/matplotlib/tests/test_contour.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from matplotlib.colors import LogNorm, same_color
1212
import matplotlib.patches as mpatches
1313
from matplotlib.testing.decorators import check_figures_equal, image_comparison
14-
from packaging.version import parse as parse_version
1514
import pytest
1615

1716

@@ -257,8 +256,7 @@ def test_contour_datetime_axis():
257256

258257
@image_comparison(['contour_test_label_transforms.png'],
259258
remove_text=True, style='mpl20',
260-
tol=1 if parse_version(np.version.version).major < 2 else
261-
0 if platform.machine() == 'x86_64' else 0.005)
259+
tol=0 if platform.machine() == 'x86_64' else 0.005)
262260
def test_labels():
263261
# Adapted from pylab_examples example code: contour_demo.py
264262
# see issues #2475, #2843, and #2818 for explanation

lib/matplotlib/tests/test_ticker.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from packaging.version import parse as parse_version
77

88
import numpy as np
9-
from numpy.testing import assert_almost_equal, assert_array_equal, assert_allclose
9+
from numpy.testing import assert_almost_equal, assert_array_equal
1010
import pytest
1111

1212
import matplotlib as mpl
@@ -1951,10 +1951,7 @@ def test_bad_locator_subs(sub):
19511951
@mpl.style.context('default')
19521952
def test_small_range_loglocator(numticks, lims, ticks):
19531953
ll = mticker.LogLocator(numticks=numticks)
1954-
if parse_version(np.version.version).major < 2:
1955-
assert_allclose(ll.tick_values(*lims), ticks, rtol=2e-16)
1956-
else:
1957-
assert_array_equal(ll.tick_values(*lims), ticks)
1954+
assert_array_equal(ll.tick_values(*lims), ticks)
19581955

19591956

19601957
@mpl.style.context('default')

lib/mpl_toolkits/mplot3d/tests/test_axes3d.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import platform
44
import sys
55

6-
from packaging.version import parse as parse_version
76
import pytest
87

98
from mpl_toolkits.mplot3d import Axes3D, axes3d, proj3d, art3d
@@ -182,8 +181,7 @@ def test_bar3d_shaded():
182181
fig.canvas.draw()
183182

184183

185-
@mpl3d_image_comparison(['bar3d_notshaded.png'], style='mpl20',
186-
tol=0.01 if parse_version(np.version.version).major < 2 else 0)
184+
@mpl3d_image_comparison(['bar3d_notshaded.png'], style='mpl20')
187185
def test_bar3d_notshaded():
188186
fig = plt.figure()
189187
ax = fig.add_subplot(projection='3d')

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ classifiers=[
3030
# - doc/devel/dependencies.rst
3131
# - environment.yml
3232
dependencies = [
33-
"contourpy >= 1.0.1",
33+
"contourpy >= 1.2.1",
3434
"cycler >= 0.10",
3535
"fonttools >= 4.22.0",
3636
"kiwisolver >= 1.3.1",
37-
"numpy >= 1.25",
37+
"numpy >= 2.0",
3838
"packaging >= 20.0",
3939
"pillow >= 9",
4040
"pyparsing >= 3",
@@ -68,11 +68,11 @@ requires = [
6868
[dependency-groups]
6969
build = [
7070
# Should be the same as `[project] dependencies` above.
71-
"contourpy >= 1.0.1",
71+
"contourpy >= 1.2.1",
7272
"cycler >= 0.10",
7373
"fonttools >= 4.22.0",
7474
"kiwisolver >= 1.3.1",
75-
"numpy >= 1.25",
75+
"numpy >= 2.0",
7676
"packaging >= 20.0",
7777
"pillow >= 9",
7878
"pyparsing >= 3",

0 commit comments

Comments
 (0)