From 81c9eb9e10550b25085d3c82860a8db9e1a97e93 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 17 May 2017 12:16:35 -0400 Subject: [PATCH 1/8] Use last release + 0.0.1 + '-dev' --- niworkflows/info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/niworkflows/info.py b/niworkflows/info.py index 681dfc13f34..7edece3c405 100644 --- a/niworkflows/info.py +++ b/niworkflows/info.py @@ -11,7 +11,7 @@ from __future__ import absolute_import, division, print_function import datetime -__version__ = '99.99.99' +__version__ = '0.0.7-dev' __packagename__ = 'niworkflows' __author__ = 'The CRN developers' __copyright__ = 'Copyright {}, Center for Reproducible Neuroscience, Stanford University'.format( From 8391e75cc8b1b05b4c5c93afd2e660ef48be2c3e Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 17 May 2017 12:21:11 -0400 Subject: [PATCH 2/8] Deprecate MNI-normalization trait at 0.0.7 --- niworkflows/anat/mni.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/niworkflows/anat/mni.py b/niworkflows/anat/mni.py index 44181e5e9ad..9b4788e1bb5 100644 --- a/niworkflows/anat/mni.py +++ b/niworkflows/anat/mni.py @@ -28,7 +28,7 @@ class RobustMNINormalizationInputSpec(BaseInterfaceInputSpec): reference_mask = File(exists=True, desc='reference image mask') num_threads = traits.Int(cpu_count(), usedefault=True, nohash=True, desc="Number of ITK threads to use") - testing = traits.Bool(False, deprecated='99.99.99', desc='use testing settings') + testing = traits.Bool(False, deprecated='0.0.7', desc='use testing settings') flavor = traits.Enum('precise', 'testing', 'fast', usedefault=True, desc='registration settings parameter set') orientation = traits.Enum('RAS', 'LAS', mandatory=True, usedefault=True, From fd1261fcf190b09cc426debc74eda9ab16e531a6 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 17 May 2017 15:01:16 -0400 Subject: [PATCH 3/8] TEST: Update test invocations, test deprecation --- niworkflows/tests/test_reports.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/niworkflows/tests/test_reports.py b/niworkflows/tests/test_reports.py index 4b0ed5d11a8..487bc4d928d 100644 --- a/niworkflows/tests/test_reports.py +++ b/niworkflows/tests/test_reports.py @@ -11,6 +11,7 @@ import nibabel as nb from nilearn import image +from traits.trait_errors import TraitError from nipype.utils.tmpdirs import InTemporaryDirectory @@ -107,16 +108,27 @@ def test_BBRegisterRPT(self): def test_RobustMNINormalizationRPT(self): """ the RobustMNINormalizationRPT report capable test """ ants_rpt = RobustMNINormalizationRPT( - generate_report=True, moving_image=self.moving, testing=True) + generate_report=True, moving_image=self.moving, flavor='testing') _smoke_test_report(ants_rpt, 'testRobustMNINormalizationRPT.svg') def test_RobustMNINormalizationRPT_masked(self): """ the RobustMNINormalizationRPT report capable test with masking """ ants_rpt = RobustMNINormalizationRPT( generate_report=True, moving_image=self.moving, - reference_mask=self.reference_mask, testing=True) + reference_mask=self.reference_mask, flavor='testing') _smoke_test_report(ants_rpt, 'testRobustMNINormalizationRPT_masked.svg') + def test_RobustMNINormalizationRPT_deprecation(self): + try: + ants_rpt = RobustMNINormalizationRPT( + generate_report=True, moving_image=self.moving, testing=True) + except TraitError as e: + if 'deprecated' not in e.msg: + raise + else: + raise Exception('RobustMNINormalizationRPT not raising trait error for ' + 'input trait "testing"') + def test_ANTSRegistrationRPT(self): """ the RobustMNINormalizationRPT report capable test """ ants_rpt = ANTSRegistrationRPT( From 7990047e2ccf63e75a57952ca549fdf072eeaae0 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 17 May 2017 17:16:09 -0400 Subject: [PATCH 4/8] Set package_version in RobustMNINormalizationInputSpec --- niworkflows/anat/mni.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/niworkflows/anat/mni.py b/niworkflows/anat/mni.py index 9b4788e1bb5..2814aac3242 100644 --- a/niworkflows/anat/mni.py +++ b/niworkflows/anat/mni.py @@ -8,6 +8,7 @@ import shutil import pkg_resources as pkgr from multiprocessing import cpu_count +from distutils.version import LooseVersion from nipype.interfaces.ants.registration import Registration, RegistrationOutputSpec from nipype.interfaces.ants.resampling import ApplyTransforms @@ -16,12 +17,18 @@ File, InputMultiPath) from niworkflows.data import getters -from niworkflows import __packagename__, NIWORKFLOWS_LOG +from niworkflows import __packagename__, NIWORKFLOWS_LOG, __version__ + +niworkflows_version = LooseVersion(__version__) + import nibabel as nb import numpy as np class RobustMNINormalizationInputSpec(BaseInterfaceInputSpec): + # Enable deprecation + package_version = niworkflows_version + moving_image = File(exists=True, mandatory=True, desc='image to apply transformation to') reference_image = File(exists=True, desc='override the reference image') moving_mask = File(exists=True, desc='moving image mask') From 03f8bf308c3d99f87a4c6c4132ce53f9b3f62bd6 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 17 May 2017 17:16:34 -0400 Subject: [PATCH 5/8] TEST: Check for a user warning --- niworkflows/tests/test_reports.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/niworkflows/tests/test_reports.py b/niworkflows/tests/test_reports.py index 487bc4d928d..b89bd1f42a9 100644 --- a/niworkflows/tests/test_reports.py +++ b/niworkflows/tests/test_reports.py @@ -8,11 +8,12 @@ import pkg_resources as pkgr from multiprocessing import cpu_count from shutil import copy +import warnings import nibabel as nb from nilearn import image -from traits.trait_errors import TraitError from nipype.utils.tmpdirs import InTemporaryDirectory +from nibabel.testing import clear_and_catch_warnings from niworkflows.data.getters import (get_mni_template_ras, get_ds003_downsampled, @@ -119,15 +120,12 @@ def test_RobustMNINormalizationRPT_masked(self): _smoke_test_report(ants_rpt, 'testRobustMNINormalizationRPT_masked.svg') def test_RobustMNINormalizationRPT_deprecation(self): - try: - ants_rpt = RobustMNINormalizationRPT( + with clear_and_catch_warnings() as w: + warnings.simplefilter('always', UserWarning) + assert len(w) == 0 + RobustMNINormalizationRPT( generate_report=True, moving_image=self.moving, testing=True) - except TraitError as e: - if 'deprecated' not in e.msg: - raise - else: - raise Exception('RobustMNINormalizationRPT not raising trait error for ' - 'input trait "testing"') + assert len(w) == 1 def test_ANTSRegistrationRPT(self): """ the RobustMNINormalizationRPT report capable test """ From 86f1f84208396e7f286421b1c98f2ace998b62b4 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Thu, 18 May 2017 09:48:01 -0400 Subject: [PATCH 6/8] Add packaging to requirements --- niworkflows/info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/niworkflows/info.py b/niworkflows/info.py index 7edece3c405..e84a0e4aae3 100644 --- a/niworkflows/info.py +++ b/niworkflows/info.py @@ -40,7 +40,7 @@ ] REQUIRES = ['nipype', 'future', 'nilearn>=0.2.6', 'sklearn', 'pandas', 'matplotlib', - 'jinja2', 'svgutils', 'tinycss'] + 'jinja2', 'svgutils', 'tinycss', 'packaging'] SETUP_REQUIRES = [] REQUIRES += SETUP_REQUIRES From 5233d8e2180dcd48ec2a0e4229e143fcf1002ff0 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Thu, 18 May 2017 09:49:19 -0400 Subject: [PATCH 7/8] Update package_version to use packaging.version.Version --- niworkflows/anat/mni.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/niworkflows/anat/mni.py b/niworkflows/anat/mni.py index 2814aac3242..1a2b9baf6cb 100644 --- a/niworkflows/anat/mni.py +++ b/niworkflows/anat/mni.py @@ -8,7 +8,7 @@ import shutil import pkg_resources as pkgr from multiprocessing import cpu_count -from distutils.version import LooseVersion +from packaging.version import Version from nipype.interfaces.ants.registration import Registration, RegistrationOutputSpec from nipype.interfaces.ants.resampling import ApplyTransforms @@ -19,7 +19,7 @@ from niworkflows.data import getters from niworkflows import __packagename__, NIWORKFLOWS_LOG, __version__ -niworkflows_version = LooseVersion(__version__) +niworkflows_version = Version(__version__) import nibabel as nb From e042944ab2911d8399e545a48c066f41d5b64029 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 24 May 2017 16:21:16 -0400 Subject: [PATCH 8/8] Update nipype pin --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 467e1ffea26..8d44821fffa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ --e git+https://github.com/nipy/nipype.git@cda3fdc3be231f2c9d7bdbdbadee472a0bad9e92#egg=nipype +-e git+https://github.com/nipy/nipype.git@c13f967506aa426c63ad4131cf29b655f742649c#egg=nipype