Skip to content

Commit 1fcb012

Browse files
authored
Merge pull request #542 from pydata/test-numpy-1.26
Test numpy 1.26
2 parents 7cadd0f + 898b4d9 commit 1fcb012

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

.github/workflows/build.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ permissions:
77

88
jobs:
99
build_wheels:
10-
name: Build wheels on ${{ matrix.os }} for ${{ matrix.arch }}
10+
name: Build and test on ${{ matrix.os }}${{ matrix.numpy-version && format(' (numpy {0})', matrix.numpy-version) || '' }} for ${{ matrix.arch }}
1111
runs-on: ${{ matrix.runs-on || matrix.os }}
1212
permissions:
1313
contents: write
@@ -24,6 +24,12 @@ jobs:
2424
arch: x86_64
2525
artifact_name: "linux-x86_64"
2626

27+
# Linux x86_64 with numpy 1.23
28+
- os: ubuntu-latest
29+
arch: x86_64
30+
artifact_name: "linux-x86_64_numpy1_23"
31+
numpy-version: "1.26"
32+
2733
# Linux ARM64 builds (native runners)
2834
- os: ubuntu-24.04-arm
2935
arch: aarch64
@@ -44,7 +50,19 @@ jobs:
4450
- uses: actions/setup-python@v3
4551
name: Install Python
4652
with:
47-
python-version: '3.x'
53+
python-version: '3.12'
54+
55+
- name: Install specific numpy version
56+
if: matrix.numpy-version
57+
run: pip install "numpy==${{ matrix.numpy-version }}.*"
58+
59+
- name: Local Build
60+
run: pip install -e .
61+
62+
- name: Test
63+
run: |
64+
pip install pytest
65+
python -m pytest
4866
4967
- name: Build wheels
5068
uses: pypa/cibuildwheel@v3.1.3

numexpr/tests/test_numexpr.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,11 @@ def test_expressions(
963963
# "overflows" or "divide by zero" in plain eval().
964964
warnings.simplefilter("ignore")
965965
try:
966-
npval = eval(expr, globals(), locals())
966+
npexpr = expr
967+
if "sign" in expr and dtype==complex and np.__version__<"2.0":
968+
#definition of sign changed in numpy 2.0 for complex numbers
969+
npexpr = expr.replace("sign(b+c)", "(b+c)/abs(b+c)")
970+
npval = eval(npexpr, globals(), locals())
967971
except Exception as ex:
968972
np_exception = ex
969973
npval = None

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
numpy >= 1.23.0 # keep in sync with NPY_TARGET_VERSION (setup.py)
1+
numpy >= 1.26.0 # keep in sync with NPY_TARGET_VERSION (setup.py)

0 commit comments

Comments
 (0)