Skip to content
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

Test with numpy 2.0.0rc1 and fix API changes of np.array()'s copy kwarg #450

Merged
merged 3 commits into from
May 23, 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
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ jobs:
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
numpy-version: [""]
architecture: [x86, x64]
os:
[
Expand All @@ -27,6 +28,12 @@ jobs:
architecture: x86
- os: macos-12
architecture: x86
include:
- python-version: "3.12"
numpy-version: ">=2.0.0rc1"
architecture: x64
os: ubuntu-latest

steps:
- uses: actions/checkout@v4

Expand All @@ -42,7 +49,7 @@ jobs:

- name: Test with pytest
run: |
pip install pytest
pip install pytest "numpy${{ matrix.numpy-version }}"
rdbisme marked this conversation as resolved.
Show resolved Hide resolved
pytest --pyargs bottleneck

check:
Expand Down
8 changes: 4 additions & 4 deletions bottleneck/slow/move.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def move_argmin(a, window, min_count=None, axis=-1):
"Slow move_argmin for unaccelerated dtype"

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

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

def move_func(func, a, window, min_count=None, axis=-1, **kwargs):
"Generic moving window function implemented with a python loop."
a = np.array(a, copy=False)
a = np.asarray(a)
if min_count is None:
mc = window
else:
Expand Down Expand Up @@ -226,7 +226,7 @@ def lastrank(a, axis=-1):
-0.5

"""
a = np.array(a, copy=False)
a = np.asarray(a)
ndim = a.ndim
if a.size == 0:
# At least one dimension has length 0
Expand Down
2 changes: 1 addition & 1 deletion bottleneck/slow/nonreduce_axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def nanrankdata(a, axis=None):


def _rank(func1d, a, axis):
a = np.array(a, copy=False)
a = np.asarray(a)
if axis is None:
a = a.ravel()
axis = 0
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ requires = [
# and disabling build isolation.
# 3. The <2.3 upper bound is for matching the numpy deprecation policy,
# it should not be loosened
"numpy>=2.0.0rc1<2.3 ; python_version >= '3.9'",
"numpy>=2.0.0rc1,<2.3 ; python_version >= '3.9'",
]
4 changes: 0 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,6 @@ def get_long_description():
install_requires=["numpy"],
extras_require={"doc": ["numpydoc", "sphinx", "gitpython"]},
cmdclass=cmdclass,
setup_requires=[
"oldest-supported-numpy ; python_version < '3.9'",
"numpy>=2.0.0rc1 ; python_version >= '3.9'"
],
ext_modules=prepare_modules(),
zip_safe=False,
)
Expand Down