Skip to content

Commit c5356da

Browse files
authored
MNT: test with numpy 2.0.0rc1 and fix API changes of np.array()'s copy kwarg (#450)
1 parent 0aa41ca commit c5356da

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
11+
numpy-version: [""]
1112
architecture: [x86, x64]
1213
os:
1314
[
@@ -27,6 +28,12 @@ jobs:
2728
architecture: x86
2829
- os: macos-12
2930
architecture: x86
31+
include:
32+
- python-version: "3.12"
33+
numpy-version: ">=2.0.0rc1"
34+
architecture: x64
35+
os: ubuntu-latest
36+
3037
steps:
3138
- uses: actions/checkout@v4
3239

@@ -42,7 +49,7 @@ jobs:
4249
4350
- name: Test with pytest
4451
run: |
45-
pip install pytest
52+
pip install pytest "numpy${{ matrix.numpy-version }}"
4653
pytest --pyargs bottleneck
4754
4855
check:

bottleneck/slow/move.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def move_argmin(a, window, min_count=None, axis=-1):
5252
"Slow move_argmin for unaccelerated dtype"
5353

5454
def argmin(a, axis):
55-
a = np.array(a, copy=False)
55+
a = np.asarray(a)
5656
flip = [slice(None)] * a.ndim
5757
flip[axis] = slice(None, None, -1)
5858
a = a[tuple(flip)] # if tie, pick index of rightmost tie
@@ -78,7 +78,7 @@ def move_argmax(a, window, min_count=None, axis=-1):
7878
"Slow move_argmax for unaccelerated dtype"
7979

8080
def argmax(a, axis):
81-
a = np.array(a, copy=False)
81+
a = np.asarray(a)
8282
flip = [slice(None)] * a.ndim
8383
flip[axis] = slice(None, None, -1)
8484
a = a[tuple(flip)] # if tie, pick index of rightmost tie
@@ -115,7 +115,7 @@ def move_rank(a, window, min_count=None, axis=-1):
115115

116116
def move_func(func, a, window, min_count=None, axis=-1, **kwargs):
117117
"Generic moving window function implemented with a python loop."
118-
a = np.array(a, copy=False)
118+
a = np.asarray(a)
119119
if min_count is None:
120120
mc = window
121121
else:
@@ -226,7 +226,7 @@ def lastrank(a, axis=-1):
226226
-0.5
227227
228228
"""
229-
a = np.array(a, copy=False)
229+
a = np.asarray(a)
230230
ndim = a.ndim
231231
if a.size == 0:
232232
# At least one dimension has length 0

bottleneck/slow/nonreduce_axis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def nanrankdata(a, axis=None):
1515

1616

1717
def _rank(func1d, a, axis):
18-
a = np.array(a, copy=False)
18+
a = np.asarray(a)
1919
if axis is None:
2020
a = a.ravel()
2121
axis = 0

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ requires = [
1414
# and disabling build isolation.
1515
# 3. The <2.3 upper bound is for matching the numpy deprecation policy,
1616
# it should not be loosened
17-
"numpy>=2.0.0rc1<2.3 ; python_version >= '3.9'",
17+
"numpy>=2.0.0rc1,<2.3 ; python_version >= '3.9'",
1818
]

setup.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,6 @@ def get_long_description():
195195
install_requires=["numpy"],
196196
extras_require={"doc": ["numpydoc", "sphinx", "gitpython"]},
197197
cmdclass=cmdclass,
198-
setup_requires=[
199-
"oldest-supported-numpy ; python_version < '3.9'",
200-
"numpy>=2.0.0rc1 ; python_version >= '3.9'"
201-
],
202198
ext_modules=prepare_modules(),
203199
zip_safe=False,
204200
)

0 commit comments

Comments
 (0)