From 915262e72d4b6a1c64cda8c61310c95321e35d0b Mon Sep 17 00:00:00 2001 From: mloubout Date: Mon, 16 Feb 2026 10:07:57 -0500 Subject: [PATCH 1/2] deps: support numpy 1.26 --- .github/workflows/pytest-core-nompi.yaml | 6 ++++++ devito/ir/support/guards.py | 2 +- requirements.txt | 2 +- tests/test_symbolics.py | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pytest-core-nompi.yaml b/.github/workflows/pytest-core-nompi.yaml index 19c2379b9f..af252116b3 100644 --- a/.github/workflows/pytest-core-nompi.yaml +++ b/.github/workflows/pytest-core-nompi.yaml @@ -46,6 +46,10 @@ jobs: pytest-ubuntu-py313-gcc14-omp ] set: [base, adjoint] + + # default for everyone + numpy: ["numpy"] + include: - name: pytest-ubuntu-py311-gcc11-cxxnoomp python-version: '3.11' @@ -67,6 +71,7 @@ jobs: arch: "gcc-14" language: "openmp" sympy: "1.12" + numpy: "numpy==1.26" - name: pytest-ubuntu-py311-gcc10-noomp python-version: '3.11' @@ -187,6 +192,7 @@ jobs: python3 -m pip install ${{ env.PIPFLAGS }} --upgrade pip python3 -m pip install ${{ env.PIPFLAGS }} -e ".[tests,extras]" python3 -m pip install ${{ env.PIPFLAGS }} sympy==${{matrix.sympy}} + python3 -m pip install ${{ env.PIPFLAGS }} ${{matrix.numpy}} - name: Check Docker image Python version if: "contains(matrix.name, 'docker')" diff --git a/devito/ir/support/guards.py b/devito/ir/support/guards.py index dbb1fe9ca7..cb961e7d46 100644 --- a/devito/ir/support/guards.py +++ b/devito/ir/support/guards.py @@ -354,7 +354,7 @@ class GuardExpr(LocalObject, BooleanFunction): it is defined. """ - dtype = np.bool + dtype = np.bool_ def __init__(self, name, liveness='eager', **kwargs): super().__init__(name, liveness=liveness, **kwargs) diff --git a/requirements.txt b/requirements.txt index 3d6838202d..39181a2c44 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ pip>=9.0.1 -numpy>=2,<=2.3.3 +numpy>=1.26,<=2.3.3 sympy>=1.12.1,<1.15 psutil>=5.1.0,<8.0 py-cpuinfo<10 diff --git a/tests/test_symbolics.py b/tests/test_symbolics.py index 85d2818940..d799c68e64 100644 --- a/tests/test_symbolics.py +++ b/tests/test_symbolics.py @@ -881,7 +881,7 @@ def test_reduce_to_number(self): w_sub = uxreplace(w_lowered, {h_x: Number(3)}) - assert np.isclose(w_sub, -0.003935689) + assert np.isclose(float(w_sub), -0.003935689) assert not w_sub.is_Mul assert w_sub.is_Number From 7423c18f4df23cd73313f6a6cf0dca8ed6aa1933 Mon Sep 17 00:00:00 2001 From: mloubout Date: Mon, 16 Feb 2026 10:09:25 -0500 Subject: [PATCH 2/2] deps: bump numpy upper bound --- .github/workflows/pytest-core-nompi.yaml | 9 ++++----- requirements.txt | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pytest-core-nompi.yaml b/.github/workflows/pytest-core-nompi.yaml index af252116b3..9b75ac714d 100644 --- a/.github/workflows/pytest-core-nompi.yaml +++ b/.github/workflows/pytest-core-nompi.yaml @@ -47,9 +47,6 @@ jobs: ] set: [base, adjoint] - # default for everyone - numpy: ["numpy"] - include: - name: pytest-ubuntu-py311-gcc11-cxxnoomp python-version: '3.11' @@ -71,7 +68,6 @@ jobs: arch: "gcc-14" language: "openmp" sympy: "1.12" - numpy: "numpy==1.26" - name: pytest-ubuntu-py311-gcc10-noomp python-version: '3.11' @@ -192,7 +188,10 @@ jobs: python3 -m pip install ${{ env.PIPFLAGS }} --upgrade pip python3 -m pip install ${{ env.PIPFLAGS }} -e ".[tests,extras]" python3 -m pip install ${{ env.PIPFLAGS }} sympy==${{matrix.sympy}} - python3 -m pip install ${{ env.PIPFLAGS }} ${{matrix.numpy}} + + - name: Backward compat for numpy 1.26 + if: matrix.name == 'pytest-ubuntu-py310-gcc14-omp' + run: python3 -m pip install ${{ env.PIPFLAGS }} numpy==1.26 - name: Check Docker image Python version if: "contains(matrix.name, 'docker')" diff --git a/requirements.txt b/requirements.txt index 39181a2c44..87b29dac9d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ pip>=9.0.1 -numpy>=1.26,<=2.3.3 +numpy>=1.26,<=2.4.3 sympy>=1.12.1,<1.15 psutil>=5.1.0,<8.0 py-cpuinfo<10