From b9cfbb5df1d762a7858748cebefbf92b3aad081f Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 5 Jul 2023 11:21:28 -0400 Subject: [PATCH 1/9] FIX: Permit newer coverage --- nipype/info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/info.py b/nipype/info.py index b6e6245511..f96e1783d5 100644 --- a/nipype/info.py +++ b/nipype/info.py @@ -152,7 +152,7 @@ def get_nipype_gitversion(): TESTS_REQUIRES = [ "codecov", - "coverage<5", + "coverage", "pytest", "pytest-cov", "pytest-env", From 6f3ed28738961b0cee72f8caf5693dd42cbebbc7 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 5 Jul 2023 11:21:38 -0400 Subject: [PATCH 2/9] FIX: make specs --- nipype/interfaces/fsl/tests/test_auto_ProbTrackX.py | 4 ++-- nipype/interfaces/fsl/tests/test_auto_ProbTrackX2.py | 4 ++-- nipype/interfaces/tests/test_auto_Dcm2niix.py | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) 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..328067806f 100644 --- a/nipype/interfaces/tests/test_auto_Dcm2niix.py +++ b/nipype/interfaces/tests/test_auto_Dcm2niix.py @@ -41,8 +41,7 @@ def test_Dcm2niix_inputs(): argstr="-i", ), merge_imgs=dict( - argstr="-m", - usedefault=True, + argstr="-m %d", ), out_filename=dict( argstr="-f %s", From d473dcbcf676303d2c0e16fa5884506baa52dac1 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 5 Jul 2023 11:22:01 -0400 Subject: [PATCH 3/9] FIX: Remove unused decorators that depended on deprecated numpy module --- nipype/testing/__init__.py | 3 -- nipype/testing/decorators.py | 98 ------------------------------------ 2 files changed, 101 deletions(-) delete mode 100644 nipype/testing/decorators.py 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 From 8dd46d3b613c2151cd9df9ec490d60605f8e07be Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 5 Jul 2023 09:56:14 -0400 Subject: [PATCH 4/9] MNT: Add afile to codespell ignores --- .codespellrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 3b89ca85faf2428ecf7844de9c0db4aa7c329c93 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 5 Jul 2023 11:30:42 -0400 Subject: [PATCH 5/9] STY: black --- nipype/interfaces/dcm2nii.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nipype/interfaces/dcm2nii.py b/nipype/interfaces/dcm2nii.py index 8a268f951a..41321855c5 100644 --- a/nipype/interfaces/dcm2nii.py +++ b/nipype/interfaces/dcm2nii.py @@ -329,7 +329,9 @@ 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, argstr="-m %d", desc="merge 2D slices from same series regardless of echo, exposure, etc. - [0=no, 1=yes, 2=auto]", ) From fc43d6521ecb72787c40fc1c1f350f606efbaa74 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 5 Jul 2023 11:32:31 -0400 Subject: [PATCH 6/9] MNT: Build docs on Python 3.10 --- .readthedocs.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 From fec8cd950c66a2f29c896ad69c0fe3f3e0e3a193 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 5 Jul 2023 12:08:51 -0400 Subject: [PATCH 7/9] MNT: Avoid looseversion 1.2 --- nipype/info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/info.py b/nipype/info.py index f96e1783d5..0dd048e38a 100644 --- a/nipype/info.py +++ b/nipype/info.py @@ -147,7 +147,7 @@ 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 = [ From 6bf5f7a89fefc4b5225c5f46b4e4168a60930ff7 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 5 Jul 2023 12:29:45 -0400 Subject: [PATCH 8/9] FIX: dcm2niix -m arguments --- nipype/interfaces/dcm2nii.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nipype/interfaces/dcm2nii.py b/nipype/interfaces/dcm2nii.py index 41321855c5..6b6de041bf 100644 --- a/nipype/interfaces/dcm2nii.py +++ b/nipype/interfaces/dcm2nii.py @@ -332,6 +332,8 @@ class Dcm2niixInputSpec(CommandLineInputSpec): 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]", ) @@ -395,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 @@ -408,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 """ @@ -423,7 +425,6 @@ def version(self): def _format_arg(self, opt, spec, val): bools = [ "bids_format", - "merge_imgs", "single_file", "verbose", "crop", From 5e2fd1cdeda57b21940271eb9393f000b810690b Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 5 Jul 2023 12:32:58 -0400 Subject: [PATCH 9/9] TEST: make specs --- nipype/interfaces/tests/test_auto_Dcm2niix.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nipype/interfaces/tests/test_auto_Dcm2niix.py b/nipype/interfaces/tests/test_auto_Dcm2niix.py index 328067806f..7563f0ddb2 100644 --- a/nipype/interfaces/tests/test_auto_Dcm2niix.py +++ b/nipype/interfaces/tests/test_auto_Dcm2niix.py @@ -42,6 +42,7 @@ def test_Dcm2niix_inputs(): ), merge_imgs=dict( argstr="-m %d", + usedefault=True, ), out_filename=dict( argstr="-f %s",