Skip to content

Commit f91899d

Browse files
committed
tests: test installed sympy version
1 parent 3c0887d commit f91899d

2 files changed

Lines changed: 19 additions & 9 deletions

File tree

.github/workflows/pytest-core-nompi.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,16 @@ jobs:
166166
python3 -m pip install ${{ env.PIPFLAGS }} sympy==${{matrix.sympy}}
167167
python3 -m pip install ${{ env.PIPFLAGS }} -e .[tests,extras]
168168
169+
- name: Check sympy version
170+
if: "!contains(matrix.name, 'docker')"
171+
run: |
172+
full=$(pip show sympy | awk '/^Version:/ {print $2}')
173+
majmin=${full%.*}
174+
if [[ $majmin != ${{ matrix.sympy }} ]]; then
175+
echo "::error::Sympy version mismatch: expected" ${{ matrix.sympy }} " got " $full
176+
exit 1
177+
fi
178+
169179
- name: Check configuration
170180
run: |
171181
${{ env.RUN_CMD }} python3 -c "from devito import configuration; print(''.join(['%s: %s \n' % (k, v) for (k, v) in configuration.items()]))"

setup.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ def numpy_compat(required):
3131
# Due to api changes in numpy 2.0, it requires sympy 1.12.1 at the minimum
3232
# Check if sympy is installed and enforce numpy version accordingly.
3333
# If sympy isn't installed, enforce sympy>=1.12.1 and numpy>=2.0
34-
try:
35-
sympy_version = Version(get_version("sympy"))
36-
min_ver2 = Version("1.12.1")
37-
if sympy_version < min_ver2:
38-
new_reqs.extend([f"numpy>{numpy_lb},<2.0", f"sympy=={sympy_version}"])
39-
else:
40-
new_reqs.extend([f"numpy>=2.0,<{numpy_ub}", f"sympy=={sympy_version}"])
41-
except PkgNotFound:
42-
new_reqs.extend([f"sympy>=1.12.1,<{sympy_ub}", f"numpy>=2.0,<{numpy_ub}"])
34+
# try:
35+
sympy_version = Version(get_version("sympy"))
36+
min_ver2 = Version("1.12.1")
37+
if sympy_version < min_ver2:
38+
new_reqs.extend([f"numpy>{numpy_lb},<2.0", f"sympy=={sympy_version}"])
39+
else:
40+
new_reqs.extend([f"numpy>=2.0,<{numpy_ub}", f"sympy=={sympy_version}"])
41+
# except PkgNotFound:
42+
# new_reqs.extend([f"sympy>=1.12.1,<{sympy_ub}", f"numpy>=2.0,<{numpy_ub}"])
4343

4444
return new_reqs
4545

0 commit comments

Comments
 (0)