Skip to content

Commit 0a700fe

Browse files
authored
Merge pull request #1337 from effigies/fix/doctest
FIX: Use legacy numpy printing during doc builds/tests
2 parents 30a5f3f + 170b20c commit 0a700fe

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

doc/source/conf.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
import tomli as tomllib
2929

3030
# Check for external Sphinx extensions we depend on
31+
try:
32+
import numpy as np
33+
except ImportError:
34+
raise RuntimeError('Need to install "numpy" package for doc build')
3135
try:
3236
import numpydoc
3337
except ImportError:
@@ -45,6 +49,11 @@
4549
'Need nibabel on Python PATH; consider "make htmldoc" from nibabel root directory'
4650
)
4751

52+
from packaging.version import Version
53+
54+
if Version(np.__version__) >= Version('1.22'):
55+
np.set_printoptions(legacy='1.21')
56+
4857
# -- General configuration ----------------------------------------------------
4958

5059
# We load the nibabel release info into a dict by explicit execution

0 commit comments

Comments
 (0)