diff --git a/.codespellrc b/.codespellrc index fcf6e648ca..4bc57b6662 100644 --- a/.codespellrc +++ b/.codespellrc @@ -5,8 +5,8 @@ skip = .git,*.pdf,*.svg,external # whos - smth used in matlab things # SMAL - Stanford CNI MRS Library # Suh - name -# noo,crasher - field/var name used +# noo,crasher,afile - field/var name used # Reson - short journal name # ALS, FWE - neuroimaging specific abbrevs # Comision - foreign word used -ignore-words-list = te,inport,objekt,jist,nd,hel,inout,fith,whos,fot,ue,shs,smal,nam,filetest,suh,noo,reson,als,fwe,crasher,comision +ignore-words-list = te,inport,objekt,jist,nd,hel,inout,fith,whos,fot,ue,shs,smal,nam,filetest,suh,noo,reson,als,fwe,crasher,comision,afile diff --git a/.readthedocs.yml b/.readthedocs.yml index 5a32188317..33b5e91a58 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -4,6 +4,12 @@ # Required version: 2 +# Set the OS, Python version and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.10" + # Build documentation in the docs/ directory with Sphinx sphinx: configuration: doc/conf.py @@ -12,9 +18,10 @@ sphinx: formats: - htmlzip -# Optionally set the version of Python and requirements required to build your docs +# Optional but recommended, declare the Python requirements required +# to build your documentation +# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html python: - version: 3.7 install: - requirements: doc/requirements.txt - method: pip diff --git a/nipype/info.py b/nipype/info.py index b6e6245511..0dd048e38a 100644 --- a/nipype/info.py +++ b/nipype/info.py @@ -147,12 +147,12 @@ def get_nipype_gitversion(): "traits>=%s,<%s,!=5.0" % (TRAITS_MIN_VERSION, TRAITS_MAX_VERSION), "filelock>=3.0.0", "etelemetry>=0.2.0", - "looseversion", + "looseversion!=1.2", ] TESTS_REQUIRES = [ "codecov", - "coverage<5", + "coverage", "pytest", "pytest-cov", "pytest-env", diff --git a/nipype/interfaces/dcm2nii.py b/nipype/interfaces/dcm2nii.py index 8a268f951a..6b6de041bf 100644 --- a/nipype/interfaces/dcm2nii.py +++ b/nipype/interfaces/dcm2nii.py @@ -329,7 +329,11 @@ class Dcm2niixInputSpec(CommandLineInputSpec): desc="Gzip compress images - [y=pigz, i=internal, n=no, 3=no,3D]", ) merge_imgs = traits.Enum( - 0, 1, 2, + 0, + 1, + 2, + default=0, + usedefault=True, argstr="-m %d", desc="merge 2D slices from same series regardless of echo, exposure, etc. - [0=no, 1=yes, 2=auto]", ) @@ -393,7 +397,7 @@ class Dcm2niix(CommandLine): >>> converter.inputs.compression = 5 >>> converter.inputs.output_dir = 'ds005' >>> converter.cmdline - 'dcm2niix -b y -z y -5 -x n -t n -m n -o ds005 -s n -v n dicomdir' + 'dcm2niix -b y -z y -5 -x n -t n -m 0 -o ds005 -s n -v n dicomdir' >>> converter.run() # doctest: +SKIP In the example below, we note that the current version of dcm2niix @@ -406,7 +410,7 @@ class Dcm2niix(CommandLine): >>> converter.inputs.compression = 5 >>> converter.inputs.output_dir = 'ds005' >>> converter.cmdline - 'dcm2niix -b y -z y -5 -x n -t n -m n -o ds005 -s n -v n .' + 'dcm2niix -b y -z y -5 -x n -t n -m 0 -o ds005 -s n -v n .' >>> converter.run() # doctest: +SKIP """ @@ -421,7 +425,6 @@ def version(self): def _format_arg(self, opt, spec, val): bools = [ "bids_format", - "merge_imgs", "single_file", "verbose", "crop", diff --git a/nipype/interfaces/fsl/tests/test_auto_ProbTrackX.py b/nipype/interfaces/fsl/tests/test_auto_ProbTrackX.py index aae5d80c57..c841391efc 100644 --- a/nipype/interfaces/fsl/tests/test_auto_ProbTrackX.py +++ b/nipype/interfaces/fsl/tests/test_auto_ProbTrackX.py @@ -90,13 +90,13 @@ def test_ProbTrackX_inputs(): argstr="--randfib=%d", ), random_seed=dict( - argstr="--rseed", + argstr="--rseed=%d", ), s2tastext=dict( argstr="--s2tastext", ), sample_random_points=dict( - argstr="--sampvox", + argstr="--sampvox=%.3f", ), samples_base_name=dict( argstr="--samples=%s", diff --git a/nipype/interfaces/fsl/tests/test_auto_ProbTrackX2.py b/nipype/interfaces/fsl/tests/test_auto_ProbTrackX2.py index 1813bd3c9c..f1941f036d 100644 --- a/nipype/interfaces/fsl/tests/test_auto_ProbTrackX2.py +++ b/nipype/interfaces/fsl/tests/test_auto_ProbTrackX2.py @@ -116,13 +116,13 @@ def test_ProbTrackX2_inputs(): argstr="--randfib=%d", ), random_seed=dict( - argstr="--rseed", + argstr="--rseed=%d", ), s2tastext=dict( argstr="--s2tastext", ), sample_random_points=dict( - argstr="--sampvox", + argstr="--sampvox=%.3f", ), samples_base_name=dict( argstr="--samples=%s", diff --git a/nipype/interfaces/tests/test_auto_Dcm2niix.py b/nipype/interfaces/tests/test_auto_Dcm2niix.py index dec95abcff..7563f0ddb2 100644 --- a/nipype/interfaces/tests/test_auto_Dcm2niix.py +++ b/nipype/interfaces/tests/test_auto_Dcm2niix.py @@ -41,7 +41,7 @@ def test_Dcm2niix_inputs(): argstr="-i", ), merge_imgs=dict( - argstr="-m", + argstr="-m %d", usedefault=True, ), out_filename=dict( diff --git a/nipype/testing/__init__.py b/nipype/testing/__init__.py index c22de2cc7a..4a0ab306f6 100644 --- a/nipype/testing/__init__.py +++ b/nipype/testing/__init__.py @@ -16,11 +16,8 @@ template = funcfile transfm = funcfile -from . import decorators from .utils import package_check, TempFATFS -skipif = decorators.dec.skipif - def example_data(infile="functional.nii"): """returns path to empty example data files for doc tests diff --git a/nipype/testing/decorators.py b/nipype/testing/decorators.py deleted file mode 100644 index a0e4c2ede1..0000000000 --- a/nipype/testing/decorators.py +++ /dev/null @@ -1,98 +0,0 @@ -# -*- coding: utf-8 -*- -# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- -# vi: set ft=python sts=4 ts=4 sw=4 et: -""" -Extend numpy's decorators to use nipype's gui and data labels. -""" -from numpy.testing import dec - -from nibabel.data import DataError - - -def make_label_dec(label, ds=None): - """Factory function to create a decorator that applies one or more labels. - - Parameters - ---------- - label : str or sequence - One or more labels that will be applied by the decorator to the - functions it decorates. Labels are attributes of the decorated function - with their value set to True. - ds : str - An optional docstring for the resulting decorator. If not given, a - default docstring is auto-generated. - - Returns - ------- - ldec : function - A decorator. - - Examples - -------- - >>> slow = make_label_dec('slow') - >>> slow.__doc__ - "Labels a test as 'slow'" - - >>> rare = make_label_dec(['slow','hard'], - ... "Mix labels 'slow' and 'hard' for rare tests") - >>> @rare - ... def f(): pass - ... - >>> - >>> f.slow - True - >>> f.hard - True - """ - if isinstance(label, str): - labels = [label] - else: - labels = label - # Validate that the given label(s) are OK for use in setattr() by doing a - # dry run on a dummy function. - tmp = lambda: None - for label in labels: - setattr(tmp, label, True) - # This is the actual decorator we'll return - - def decor(f): - for label in labels: - setattr(f, label, True) - return f - - # Apply the user's docstring - if ds is None: - ds = "Labels a test as %r" % label - decor.__doc__ = ds - return decor - - -# For tests that need further review - - -def needs_review(msg): - """Skip a test that needs further review. - - Parameters - ---------- - msg : string - msg regarding the review that needs to be done - """ - - def skip_func(func): - return dec.skipif(True, msg)(func) - - return skip_func - - -# Easier version of the numpy knownfailure -def knownfailure(f): - return dec.knownfailureif(True)(f) - - -def if_datasource(ds, msg): - try: - ds.get_filename() - except DataError: - return dec.skipif(True, msg) - return lambda f: f