Skip to content

Commit 10169f3

Browse files
authored
Merge pull request #2654 from nipy/dev/2.0
MNT: Drop Python 2 support
2 parents 05b5bbb + 39fbd54 commit 10169f3

File tree

1,101 files changed

+155
-2590
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,101 files changed

+155
-2590
lines changed
File renamed without changes.

.circleci/config.yml

Lines changed: 33 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,6 @@ _build_main_image_py36: &build_main_image_py36
5656
--build-arg VCS_REF="$(git rev-parse --short HEAD)" \
5757
--build-arg VERSION="${CIRCLE_TAG}" /home/circleci/nipype
5858
59-
_build_main_image_py27: &build_main_image_py27
60-
name: Build main image (py27)
61-
no_output_timeout: 60m
62-
command: |
63-
tools/retry_cmd.sh -n 5 -s 15 \
64-
docker build \
65-
--rm=false \
66-
--tag nipype/nipype:py27 \
67-
--build-arg PYTHON_VERSION_MAJOR=2 \
68-
--build-arg PYTHON_VERSION_MINOR=7 \
69-
--build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
70-
--build-arg VCS_REF="$(git rev-parse --short HEAD)" \
71-
--build-arg VERSION="${CIRCLE_TAG}-py27" /home/circleci/nipype
72-
7359
_download_test_data: &_download_test_data
7460
name: Download test data
7561
no_output_timeout: 20m
@@ -161,28 +147,22 @@ jobs:
161147
- run: *modify_nipype_version
162148
- run: *get_base_image
163149
- run: *build_main_image_py36
164-
- run: *build_main_image_py27
165150
- run: *_get_codecov
166151
- run: *_download_test_data
167152
- run: *prepare_working_directory
168153
- run:
169-
name: Run pytests (py36)
154+
name: Run pytests
170155
no_output_timeout: 30m
171156
environment: *test_environment
172-
command: bash -ux /home/circleci/nipype/.circleci/test_py3_pytest.sh
173-
- run:
174-
name: Run pytests (py27)
175-
no_output_timeout: 30m
176-
environment: *test_environment
177-
command: bash -ux /home/circleci/nipype/.circleci/test_py2_pytest.sh
157+
command: bash -ux /home/circleci/nipype/.circleci/test_pytest.sh
178158
- run: *_run_codecov_coverage
179159
- store_artifacts: *store_artifacts_kwds
180160
- store_test_results: *store_artifacts_kwds
181161
- run:
182-
name: Build docs (py36)
162+
name: Build docs
183163
no_output_timeout: 30m
184164
environment: *test_environment
185-
command: bash -ux /home/circleci/nipype/.circleci/test_py3_docs.sh
165+
command: bash -ux /home/circleci/nipype/.circleci/build_docs.sh
186166
- store_artifacts:
187167
path: /home/circleci/work/docs
188168
- run:
@@ -192,16 +172,15 @@ jobs:
192172
if [ "$CIRCLE_BRANCH" = "master" -a -z "$CIRCLE_PULL_REQUEST" ]; then
193173
docker save nipype/nipype:base \
194174
nipype/nipype:latest \
195-
nipype/nipype:py27 \
196-
nipype/nipype:py36 | gzip -1 > /tmp/docker/nipype-base-latest-py36-py27.tar.gz \
197-
&& du -h /tmp/docker/nipype-base-latest-py36-py27.tar.gz
175+
nipype/nipype:py36 | gzip -1 > /tmp/docker/nipype-base-latest-py36.tar.gz \
176+
&& du -h /tmp/docker/nipype-base-latest-py36.tar.gz
198177
fi
199178
- persist_to_workspace:
200179
root: /tmp
201180
paths:
202181
- docker
203182

204-
test_py3_fmri_fsl_spm:
183+
test_fmri_fsl_spm:
205184
machine: *machine_kwds
206185
working_directory: /home/circleci/nipype
207186
steps:
@@ -218,24 +197,24 @@ jobs:
218197
- run: *_download_test_data
219198
- run: *prepare_working_directory
220199
- run:
221-
name: Run FSL reuse pipeline (py36)
200+
name: Run FSL reuse pipeline
222201
no_output_timeout: 40m
223202
environment: *test_environment
224-
command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh
203+
command: bash -ux /home/circleci/nipype/.circleci/test_fmri_fsl_reuse_linear_l1.sh
225204
- run:
226-
name: Run SPM test workflow - 3D inputs (py36)
205+
name: Run SPM test workflow - 3D inputs
227206
no_output_timeout: 40m
228207
environment: *test_environment
229-
command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_3d.sh
208+
command: bash -ux /home/circleci/nipype/.circleci/test_fmri_spm_linear_3d.sh
230209
- run:
231-
name: Run SPM test workflow - 4D inputs (py36)
210+
name: Run SPM test workflow - 4D inputs
232211
no_output_timeout: 40m
233212
environment: *test_environment
234-
command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_4d.sh
213+
command: bash -ux /home/circleci/nipype/.circleci/test_fmri_spm_linear_4d.sh
235214
- run: *_run_codecov_smoke
236215
- store_artifacts: *store_artifacts_kwds
237216

238-
test_py3_fmri_spm_dartel_multiproc:
217+
test_fmri_spm_dartel_multiproc:
239218
machine: *machine_kwds
240219
working_directory: /home/circleci/nipype
241220
steps:
@@ -252,15 +231,15 @@ jobs:
252231
- run: *_download_test_data
253232
- run: *prepare_working_directory
254233
- run:
255-
name: Run SPM DARTEL Level 1 pipeline (py36)
234+
name: Run SPM DARTEL Level 1 pipeline
256235
no_output_timeout: 1h
257236
environment: *test_environment
258-
command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_multiproc_l1.sh
237+
command: bash -ux /home/circleci/nipype/.circleci/test_fmri_spm_dartel_multiproc_l1.sh
259238
- run:
260-
name: Run SPM DARTEL Level 2 pipeline (py36)
239+
name: Run SPM DARTEL Level 2 pipeline
261240
no_output_timeout: 30m
262241
environment: *test_environment
263-
command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh
242+
command: bash -ux /home/circleci/nipype/.circleci/test_fmri_spm_dartel_multiproc_l2.sh
264243
- run: *_run_codecov_smoke
265244
- store_artifacts: *store_artifacts_kwds
266245

@@ -277,25 +256,24 @@ jobs:
277256
- run: *modify_nipype_version
278257
- run: *get_base_image
279258
- run: *build_main_image_py36
280-
- run: *build_main_image_py27
281259
- run: *_get_codecov
282260
- run: *_download_test_data
283261
- run: *prepare_working_directory
284262
- run:
285-
name: Run SPM Nested Level 1 pipeline (py36)
263+
name: Run SPM Nested Level 1 pipeline
286264
no_output_timeout: 1h
287265
environment: *test_environment
288-
command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh
266+
command: bash -ux /home/circleci/nipype/.circleci/test_fmri_spm_nested_multiproc_l1.sh
289267
- run:
290-
name: Run SPM Nested Level 2 pipeline (py27)
268+
name: Run SPM Nested Level 2 pipeline
291269
no_output_timeout: 30m
292270
environment: *test_environment
293-
command: bash -ux /home/circleci/nipype/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh
271+
command: bash -ux /home/circleci/nipype/.circleci/test_fmri_spm_nested_multiproc_l2.sh
294272
- run:
295-
name: Run FSL FEEDS pipeline (py36)
273+
name: Run FSL FEEDS pipeline
296274
no_output_timeout: 40m
297275
environment: *test_environment
298-
command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh
276+
command: bash -ux /home/circleci/nipype/.circleci/test_fmri_fsl_feeds_linear_l1.sh
299277
- run: *_run_codecov_smoke
300278
- store_artifacts: *store_artifacts_kwds
301279

@@ -310,7 +288,7 @@ jobs:
310288
name: Load saved Docker images.
311289
no_output_timeout: 60m
312290
command: |
313-
docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz
291+
docker load < /tmp/docker/nipype-base-latest-py36.tar.gz
314292
- run:
315293
name: Push to DockerHub
316294
no_output_timeout: 120m
@@ -319,7 +297,6 @@ jobs:
319297
docker push nipype/nipype:base
320298
docker push nipype/nipype:latest
321299
docker push nipype/nipype:py36
322-
docker push nipype/nipype:py27
323300
- run:
324301
name: Move pruned Dockerfile to /tmp/docker/cache directory
325302
command: |
@@ -343,30 +320,20 @@ jobs:
343320
pip install --upgrade pip twine future wheel readme_renderer setuptools
344321
python setup.py sdist bdist_wheel
345322
twine check dist/*
346-
- run:
347-
name: Validate Python 2 installation
348-
command: |
349-
pyenv local 2.7.12
350-
pip install --upgrade pip
351-
pip install dist/nipype-*-py2.py3-none-any.whl
352-
# Futures should install in Python 2
353-
pip show futures 2>/dev/null | grep "Name: futures"
354323
- run:
355324
name: Validate Python 3 installation
356325
command: |
357326
pyenv local 3.6.5
358327
pip install --upgrade pip
359-
pip install dist/nipype-*-py2.py3-none-any.whl
360-
# Futures should not install in Python 3
361-
test $(pip show futures 2>/dev/null | wc -l) = "0"
328+
pip install dist/nipype-*-py3-none-any.whl
362329
- run:
363330
name: Validate Python 3.7 installation
364331
command: |
365332
pyenv local 3.7.0
366333
pip install --upgrade pip
367334
# Pre-install a version of numpy that will not pass
368335
pip install numpy==1.15.0
369-
pip install dist/nipype-*-py2.py3-none-any.whl
336+
pip install dist/nipype-*-py3-none-any.whl
370337
# Numpy should be upgraded to >= 1.15.3
371338
test "$(pip show numpy | grep Version)" \> "Version: 1.15.2"
372339
- run:
@@ -390,7 +357,7 @@ jobs:
390357
name: Deploy to PyPI
391358
command: |
392359
pyenv local 3.6.5
393-
pip install --upgrade twine future wheel readme_renderer setuptools
360+
pip install --upgrade twine wheel readme_renderer setuptools
394361
python setup.py check -r -s
395362
python setup.py sdist bdist_wheel
396363
twine upload dist/*
@@ -434,7 +401,7 @@ workflows:
434401
- pypi_precheck:
435402
filters:
436403
branches:
437-
only: /rel\/.*/
404+
only: /(rel|dev)\/.*/
438405
tags:
439406
only: /.*/
440407
- compare_base_dockerfiles:
@@ -447,10 +414,10 @@ workflows:
447414
only: /.*/
448415
requires:
449416
- compare_base_dockerfiles
450-
- test_py3_fmri_fsl_spm:
417+
- test_fmri_fsl_spm:
451418
requires:
452419
- compare_base_dockerfiles
453-
- test_py3_fmri_spm_dartel_multiproc:
420+
- test_fmri_spm_dartel_multiproc:
454421
requires:
455422
- compare_base_dockerfiles
456423
- test_fmri_spm_nested_fsl_feeds:
@@ -463,8 +430,8 @@ workflows:
463430
requires:
464431
- test_pytest
465432
- test_fmri_spm_nested_fsl_feeds
466-
- test_py3_fmri_fsl_spm
467-
- test_py3_fmri_spm_dartel_multiproc
433+
- test_fmri_fsl_spm
434+
- test_fmri_spm_dartel_multiproc
468435
- deploy_pypi:
469436
filters:
470437
branches:
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22

3-
docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e NIPYPE_NUMBER_OF_CPUS=4 -e NIPYPE_RESOURCE_MONITOR=1 "${DOCKER_IMAGE}:py27" /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ l2pipeline
3+
docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e NIPYPE_NUMBER_OF_CPUS=4 -e NIPYPE_RESOURCE_MONITOR=1 "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ l2pipeline

.circleci/test_py2_pytest.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.
File renamed without changes.

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ sudo: true
44
language: python
55
# our build matrix
66
python:
7-
- 2.7
87
- 3.5
98
- 3.6
109
- 3.7

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ One your PR is ready a member of the development team will review your changes t
122122
In general, do not catch exceptions without good reason.
123123
For non-fatal exceptions, log the exception as a warning and add more information about what may have caused the error.
124124

125-
If you do need to catch an exception, raise a new exception using ``raise_from(NewException("message"), oldException)`` from ``future``.
125+
If you do need to catch an exception, raise a new exception using ``raise NewException("message") from oldException)``.
126126
Do not log this, as it creates redundant/confusing logs.
127127

128128
#### Testing

nipype/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# -*- coding: utf-8 -*-
22
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
33
# vi: set ft=python sts=4 ts=4 sw=4 et:
4-
from __future__ import (print_function, division, unicode_literals,
5-
absolute_import)
6-
74
import os
85
from distutils.version import LooseVersion
96

nipype/algorithms/confounds.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
'''
55
Algorithms to compute confounds in :abbr:`fMRI (functional MRI)`
66
'''
7-
from __future__ import (print_function, division, unicode_literals,
8-
absolute_import)
9-
from builtins import range
10-
117
import os
128
import os.path as op
139
from collections import OrderedDict

nipype/algorithms/icc.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
from __future__ import (print_function, division, unicode_literals,
3-
absolute_import)
4-
from builtins import range
52
import os
63
import numpy as np
74
from numpy import ones, kron, mean, eye, hstack, dot, tile

nipype/algorithms/mesh.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
"""
55
Miscellaneous algorithms for 2D contours and 3D triangularized meshes handling
66
"""
7-
from __future__ import (print_function, division, unicode_literals,
8-
absolute_import)
9-
from builtins import zip, str, bytes
10-
117
import os.path as op
128
import numpy as np
139
from numpy import linalg as nla

nipype/algorithms/metrics.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
Image assessment algorithms. Typical overlap and error computation
66
measures to evaluate results from other processing units.
77
'''
8-
from __future__ import (print_function, division, unicode_literals,
9-
absolute_import)
10-
from builtins import zip, range
11-
128
import os
139
import os.path as op
1410

nipype/algorithms/misc.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
'''
55
Miscellaneous algorithms
66
'''
7-
from __future__ import (print_function, division, unicode_literals,
8-
absolute_import)
9-
from builtins import str, zip, range, open
10-
from future.utils import raise_from
11-
127
import os
138
import os.path as op
149

@@ -794,9 +789,8 @@ def _run_interface(self, runtime):
794789
try:
795790
import pandas as pd
796791
except ImportError as e:
797-
raise_from(
798-
ImportError('This interface requires pandas '
799-
'(http://pandas.pydata.org/) to run.'), e)
792+
raise ImportError('This interface requires pandas '
793+
'(http://pandas.pydata.org/) to run.') from e
800794

801795
try:
802796
from filelock import SoftFileLock

nipype/algorithms/modelgen.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@
1111
1212
* SpecifyModel: allows specification of sparse and non-sparse models
1313
"""
14-
from __future__ import (print_function, division, unicode_literals,
15-
absolute_import)
16-
17-
str_basetype = str
18-
from builtins import range, str, bytes, int
19-
2014
from copy import deepcopy
2115
import csv, math, os
2216

@@ -175,7 +169,7 @@ def bids_gen_info(bids_event_files,
175169
info = []
176170
for bids_event_file in bids_event_files:
177171
with open(bids_event_file) as f:
178-
f_events = csv.DictReader(f, skipinitialspace=True, delimiter=str_basetype('\t'))
172+
f_events = csv.DictReader(f, skipinitialspace=True, delimiter='\t')
179173
events = [{k: v for k, v in row.items()} for row in f_events]
180174
if not condition_column:
181175
condition_column = '_trial_type'

nipype/algorithms/rapidart.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
* StimulusCorrelation: determines correlation between stimuli
1313
schedule and movement/intensity parameters
1414
"""
15-
from __future__ import (print_function, division, unicode_literals,
16-
absolute_import)
17-
from builtins import open, range, str, bytes
18-
1915
import os
2016
from copy import deepcopy
2117

nipype/algorithms/stats.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
"""
55
Managing statistical maps
66
"""
7-
from __future__ import (print_function, division, unicode_literals,
8-
absolute_import)
97
import os
108
import nibabel as nb
119
import numpy as np

nipype/algorithms/tests/test_auto_ACompCor.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2-
from __future__ import unicode_literals
32
from ..confounds import ACompCor
43

54

0 commit comments

Comments
 (0)