From 170b20c53a3c0c0bfae29ebd8c14638cfb9d192e Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Fri, 5 Jul 2024 21:10:41 -0400 Subject: [PATCH] FIX: Use legacy numpy printing during doc builds/tests --- doc/source/conf.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/source/conf.py b/doc/source/conf.py index f4ab16d2d..4255ff184 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -28,6 +28,10 @@ import tomli as tomllib # Check for external Sphinx extensions we depend on +try: + import numpy as np +except ImportError: + raise RuntimeError('Need to install "numpy" package for doc build') try: import numpydoc except ImportError: @@ -45,6 +49,11 @@ 'Need nibabel on Python PATH; consider "make htmldoc" from nibabel root directory' ) +from packaging.version import Version + +if Version(np.__version__) >= Version('1.22'): + np.set_printoptions(legacy='1.21') + # -- General configuration ---------------------------------------------------- # We load the nibabel release info into a dict by explicit execution