Skip to content

MNT: Drop Python 2 support #2654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 42 commits into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
1108430
CI: Drop Python 2 tests
effigies Jul 25, 2018
4a84a02
RF: Remove builtins
effigies Jul 25, 2018
9e47ec0
RF: Drop one-line __future__ imports
effigies Jul 25, 2018
06ecbe4
RF: Remove two-line __future__ imports
effigies Jul 25, 2018
b90f7d5
MAINT: Update version, supported Python versions
effigies Jul 25, 2018
b5ef915
FIX: Dangling import
effigies Jul 25, 2018
e968b8d
RF: Drop imports in checkspecs
effigies Jul 25, 2018
7a0e638
MAINT: make specs
effigies Jul 25, 2018
fa347ae
CI: Drop 2.7, add 3.7-dev on Travis
effigies Jul 25, 2018
f25cfc0
RF: Purge PY2/PY3 indicators
effigies Jul 25, 2018
323663f
RF: Purge "from io import open"
effigies Jul 25, 2018
e2dc9f8
DOC: Suggest raise from syntax
effigies Jul 25, 2018
9517c5a
TEST: Drop legacy auto tests
effigies Jul 26, 2018
f4f7865
Merge remote-tracking branch 'upstream/master' into dev/2.0
effigies Jul 30, 2018
421600b
Merge remote-tracking branch 'upstream/master' into dev/2.0
effigies Aug 13, 2018
1e5344e
CI: Build Python 3 wheels only
effigies Aug 13, 2018
055a59f
FIX: Run decode on bytes, not tuple
effigies Aug 13, 2018
938cdf4
CI: Do not install future, remove futures check
effigies Aug 13, 2018
f31416a
Merge remote-tracking branch 'upstream/master' into dev/2.0
effigies Aug 30, 2018
e990c69
Merge remote-tracking branch 'upstream/master' into dev/2.0
effigies Sep 24, 2018
2cfcd5a
Merge remote-tracking branch 'upstream/master' into dev/2.0
effigies Oct 11, 2018
dbfaf7e
Merge remote-tracking branch 'upstream/master' into dev/2.0
effigies Nov 14, 2018
9880669
Merge branch 'master' into dev/2.0
effigies Dec 17, 2018
83e4dc9
PY3: Drop future/builtins imports
effigies Dec 17, 2018
e057971
MAINT: Minimum python version > 3.2
effigies Dec 17, 2018
b0d464c
RF: Drop various remaining compatibilities for Python < 3.5
effigies Dec 17, 2018
be2d8c5
RF: Drop to_str, makedirs compatibility functions
effigies Dec 17, 2018
5ab2fa0
FIX: import os - mistakenly dropped
effigies Dec 17, 2018
dc89681
FIX: os.makedirs does not return directory
effigies Dec 17, 2018
80ed64d
Merge pull request #2831 from effigies/dev/2/min_version
effigies Jan 1, 2019
f112c58
Merge remote-tracking branch 'upstream/master' into dev/2.0
effigies Jan 28, 2019
d997694
Merge remote-tracking branch 'upstream/master' into dev/2.0
effigies Feb 25, 2019
375d00f
Merge branch 'master' into dev/2.0
effigies May 9, 2019
08cd3d3
MAINT: Sort dependencies
effigies Aug 21, 2019
f464954
Merge remote-tracking branch 'upstream/master' into dev/2.0
effigies Aug 21, 2019
7baa6d3
PY3: Remove PY2 str hack
effigies Aug 21, 2019
797841b
Merge branch 'master' into dev/2.0
effigies Oct 8, 2019
72ac8a5
MNT: Missed Py2 cleanups
effigies Oct 8, 2019
7b9c639
MNT: Drop Py2 compatibility for tools/
effigies Oct 8, 2019
497b44d
STY: Black files pre-merge
effigies Nov 12, 2019
49cc0a7
Merge remote-tracking branch 'upstream/master' into dev/2.0
effigies Nov 12, 2019
39fbd54
FIX: Missed merge issue
effigies Nov 12, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
File renamed without changes.
94 changes: 33 additions & 61 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,6 @@ _build_main_image_py36: &build_main_image_py36
--build-arg VCS_REF="$(git rev-parse --short HEAD)" \
--build-arg VERSION="${CIRCLE_TAG}" /home/circleci/nipype

_build_main_image_py27: &build_main_image_py27
name: Build main image (py27)
no_output_timeout: 60m
command: |
tools/retry_cmd.sh -n 5 -s 15 \
docker build \
--rm=false \
--tag nipype/nipype:py27 \
--build-arg PYTHON_VERSION_MAJOR=2 \
--build-arg PYTHON_VERSION_MINOR=7 \
--build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
--build-arg VCS_REF="$(git rev-parse --short HEAD)" \
--build-arg VERSION="${CIRCLE_TAG}-py27" /home/circleci/nipype

_download_test_data: &_download_test_data
name: Download test data
no_output_timeout: 20m
Expand Down Expand Up @@ -161,28 +147,22 @@ jobs:
- run: *modify_nipype_version
- run: *get_base_image
- run: *build_main_image_py36
- run: *build_main_image_py27
- run: *_get_codecov
- run: *_download_test_data
- run: *prepare_working_directory
- run:
name: Run pytests (py36)
name: Run pytests
no_output_timeout: 30m
environment: *test_environment
command: bash -ux /home/circleci/nipype/.circleci/test_py3_pytest.sh
- run:
name: Run pytests (py27)
no_output_timeout: 30m
environment: *test_environment
command: bash -ux /home/circleci/nipype/.circleci/test_py2_pytest.sh
command: bash -ux /home/circleci/nipype/.circleci/test_pytest.sh
- run: *_run_codecov_coverage
- store_artifacts: *store_artifacts_kwds
- store_test_results: *store_artifacts_kwds
- run:
name: Build docs (py36)
name: Build docs
no_output_timeout: 30m
environment: *test_environment
command: bash -ux /home/circleci/nipype/.circleci/test_py3_docs.sh
command: bash -ux /home/circleci/nipype/.circleci/build_docs.sh
- store_artifacts:
path: /home/circleci/work/docs
- run:
Expand All @@ -192,16 +172,15 @@ jobs:
if [ "$CIRCLE_BRANCH" = "master" -a -z "$CIRCLE_PULL_REQUEST" ]; then
docker save nipype/nipype:base \
nipype/nipype:latest \
nipype/nipype:py27 \
nipype/nipype:py36 | gzip -1 > /tmp/docker/nipype-base-latest-py36-py27.tar.gz \
&& du -h /tmp/docker/nipype-base-latest-py36-py27.tar.gz
nipype/nipype:py36 | gzip -1 > /tmp/docker/nipype-base-latest-py36.tar.gz \
&& du -h /tmp/docker/nipype-base-latest-py36.tar.gz
fi
- persist_to_workspace:
root: /tmp
paths:
- docker

test_py3_fmri_fsl_spm:
test_fmri_fsl_spm:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we consider breaking off the workflows and workflow tests to niflows, before we break off 2.0?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm also fine with making all the breaks with 2.0.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to start moving things to niflows. Have we figured out a working plan for that? Maybe could do a chat sometime this week to iron out a rough plan?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll coordinate a time.

machine: *machine_kwds
working_directory: /home/circleci/nipype
steps:
Expand All @@ -218,24 +197,24 @@ jobs:
- run: *_download_test_data
- run: *prepare_working_directory
- run:
name: Run FSL reuse pipeline (py36)
name: Run FSL reuse pipeline
no_output_timeout: 40m
environment: *test_environment
command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh
command: bash -ux /home/circleci/nipype/.circleci/test_fmri_fsl_reuse_linear_l1.sh
- run:
name: Run SPM test workflow - 3D inputs (py36)
name: Run SPM test workflow - 3D inputs
no_output_timeout: 40m
environment: *test_environment
command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_3d.sh
command: bash -ux /home/circleci/nipype/.circleci/test_fmri_spm_linear_3d.sh
- run:
name: Run SPM test workflow - 4D inputs (py36)
name: Run SPM test workflow - 4D inputs
no_output_timeout: 40m
environment: *test_environment
command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_4d.sh
command: bash -ux /home/circleci/nipype/.circleci/test_fmri_spm_linear_4d.sh
- run: *_run_codecov_smoke
- store_artifacts: *store_artifacts_kwds

test_py3_fmri_spm_dartel_multiproc:
test_fmri_spm_dartel_multiproc:
machine: *machine_kwds
working_directory: /home/circleci/nipype
steps:
Expand All @@ -252,15 +231,15 @@ jobs:
- run: *_download_test_data
- run: *prepare_working_directory
- run:
name: Run SPM DARTEL Level 1 pipeline (py36)
name: Run SPM DARTEL Level 1 pipeline
no_output_timeout: 1h
environment: *test_environment
command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_multiproc_l1.sh
command: bash -ux /home/circleci/nipype/.circleci/test_fmri_spm_dartel_multiproc_l1.sh
- run:
name: Run SPM DARTEL Level 2 pipeline (py36)
name: Run SPM DARTEL Level 2 pipeline
no_output_timeout: 30m
environment: *test_environment
command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh
command: bash -ux /home/circleci/nipype/.circleci/test_fmri_spm_dartel_multiproc_l2.sh
- run: *_run_codecov_smoke
- store_artifacts: *store_artifacts_kwds

Expand All @@ -277,25 +256,24 @@ jobs:
- run: *modify_nipype_version
- run: *get_base_image
- run: *build_main_image_py36
- run: *build_main_image_py27
- run: *_get_codecov
- run: *_download_test_data
- run: *prepare_working_directory
- run:
name: Run SPM Nested Level 1 pipeline (py36)
name: Run SPM Nested Level 1 pipeline
no_output_timeout: 1h
environment: *test_environment
command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh
command: bash -ux /home/circleci/nipype/.circleci/test_fmri_spm_nested_multiproc_l1.sh
- run:
name: Run SPM Nested Level 2 pipeline (py27)
name: Run SPM Nested Level 2 pipeline
no_output_timeout: 30m
environment: *test_environment
command: bash -ux /home/circleci/nipype/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh
command: bash -ux /home/circleci/nipype/.circleci/test_fmri_spm_nested_multiproc_l2.sh
- run:
name: Run FSL FEEDS pipeline (py36)
name: Run FSL FEEDS pipeline
no_output_timeout: 40m
environment: *test_environment
command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh
command: bash -ux /home/circleci/nipype/.circleci/test_fmri_fsl_feeds_linear_l1.sh
- run: *_run_codecov_smoke
- store_artifacts: *store_artifacts_kwds

Expand All @@ -310,7 +288,7 @@ jobs:
name: Load saved Docker images.
no_output_timeout: 60m
command: |
docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz
docker load < /tmp/docker/nipype-base-latest-py36.tar.gz
- run:
name: Push to DockerHub
no_output_timeout: 120m
Expand All @@ -319,7 +297,6 @@ jobs:
docker push nipype/nipype:base
docker push nipype/nipype:latest
docker push nipype/nipype:py36
docker push nipype/nipype:py27
- run:
name: Move pruned Dockerfile to /tmp/docker/cache directory
command: |
Expand All @@ -339,21 +316,15 @@ jobs:
- run:
name: Check pypi preconditions
command: |
pyenv local 3.5.2
pip install --upgrade twine future wheel readme_renderer setuptools
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we remove future?

python setup.py check -r -s
python setup.py sdist bdist_wheel
- run:
name: Validate Python 2 installation
command: |
pyenv local 2.7.12
pip install dist/nipype-*-py2.py3-none-any.whl
# Futures should install in Python 2
pip show futures 2>/dev/null | grep "Name: futures"
- run:
name: Validate Python 3 installation
command: |
pyenv local 3.5.2
pip install dist/nipype-*-py2.py3-none-any.whl
pip install dist/nipype-*-py3-none-any.whl
# Futures should not install in Python 3
test $(pip show futures 2>/dev/null | wc -l) = "0"
- store_artifacts:
Expand All @@ -368,6 +339,7 @@ jobs:
- run:
name: Deploy to PyPI
command: |
pyenv local 3.5.2
pip install --upgrade twine future wheel readme_renderer setuptools
python setup.py check -r -s
python setup.py sdist bdist_wheel
Expand Down Expand Up @@ -412,7 +384,7 @@ workflows:
- pypi_precheck:
filters:
branches:
only: /rel\/.*/
only: /(rel|dev)\/.*/
tags:
only: /.*/
- compare_base_dockerfiles:
Expand All @@ -425,10 +397,10 @@ workflows:
only: /.*/
requires:
- compare_base_dockerfiles
- test_py3_fmri_fsl_spm:
- test_fmri_fsl_spm:
requires:
- compare_base_dockerfiles
- test_py3_fmri_spm_dartel_multiproc:
- test_fmri_spm_dartel_multiproc:
requires:
- compare_base_dockerfiles
- test_fmri_spm_nested_fsl_feeds:
Expand All @@ -441,8 +413,8 @@ workflows:
requires:
- test_pytest
- test_fmri_spm_nested_fsl_feeds
- test_py3_fmri_fsl_spm
- test_py3_fmri_spm_dartel_multiproc
- test_fmri_fsl_spm
- test_fmri_spm_dartel_multiproc
- deploy_pypi:
filters:
branches:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

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
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
3 changes: 0 additions & 3 deletions .circleci/test_py2_pytest.sh

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ sudo: required
language: python
# our build matrix
python:
- 2.7
- 3.4
- 3.5
- 3.6
- 3.7-dev

env:
global:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ One your PR is ready a member of the development team will review your changes t
In general, do not catch exceptions without good reason.
For non-fatal exceptions, log the exception as a warning and add more information about what may have caused the error.

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

#### Testing
Expand Down
3 changes: 0 additions & 3 deletions nipype/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# -*- 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:
from __future__ import (print_function, division, unicode_literals,
absolute_import)

import os
from distutils.version import LooseVersion

Expand Down
4 changes: 0 additions & 4 deletions nipype/algorithms/confounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
'''
Algorithms to compute confounds in :abbr:`fMRI (functional MRI)`
'''
from __future__ import (print_function, division, unicode_literals,
absolute_import)
from builtins import range

import os
import os.path as op

Expand Down
3 changes: 0 additions & 3 deletions nipype/algorithms/icc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import (print_function, division, unicode_literals,
absolute_import)
from builtins import range
import os
import numpy as np
from numpy import ones, kron, mean, eye, hstack, dot, tile
Expand Down
4 changes: 0 additions & 4 deletions nipype/algorithms/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
"""
Miscellaneous algorithms for 2D contours and 3D triangularized meshes handling
"""
from __future__ import (print_function, division, unicode_literals,
absolute_import)
from builtins import zip, str, bytes

import os.path as op
import numpy as np
from numpy import linalg as nla
Expand Down
4 changes: 0 additions & 4 deletions nipype/algorithms/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
Image assessment algorithms. Typical overlap and error computation
measures to evaluate results from other processing units.
'''
from __future__ import (print_function, division, unicode_literals,
absolute_import)
from builtins import zip, range

import os
import os.path as op

Expand Down
10 changes: 2 additions & 8 deletions nipype/algorithms/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
'''
Miscellaneous algorithms
'''
from __future__ import (print_function, division, unicode_literals,
absolute_import)
from builtins import str, zip, range, open
from future.utils import raise_from

import os
import os.path as op

Expand Down Expand Up @@ -794,9 +789,8 @@ def _run_interface(self, runtime):
try:
import pandas as pd
except ImportError as e:
raise_from(
ImportError('This interface requires pandas '
'(http://pandas.pydata.org/) to run.'), e)
raise ImportError('This interface requires pandas '
'(http://pandas.pydata.org/) to run.') from e

try:
import lockfile as pl
Expand Down
4 changes: 0 additions & 4 deletions nipype/algorithms/modelgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@

* SpecifyModel: allows specification of sparse and non-sparse models
"""
from __future__ import (print_function, division, unicode_literals,
absolute_import)
from builtins import range, str, bytes, int

from copy import deepcopy
import os

Expand Down
4 changes: 0 additions & 4 deletions nipype/algorithms/rapidart.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
* StimulusCorrelation: determines correlation between stimuli
schedule and movement/intensity parameters
"""
from __future__ import (print_function, division, unicode_literals,
absolute_import)
from builtins import open, range, str, bytes

import os
from copy import deepcopy

Expand Down
2 changes: 0 additions & 2 deletions nipype/algorithms/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
"""
Managing statistical maps
"""
from __future__ import (print_function, division, unicode_literals,
absolute_import)
import os
import nibabel as nb
import numpy as np
Expand Down
1 change: 0 additions & 1 deletion nipype/algorithms/tests/test_auto_ACompCor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..confounds import ACompCor


Expand Down
1 change: 0 additions & 1 deletion nipype/algorithms/tests/test_auto_ActivationCount.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..stats import ActivationCount


Expand Down
1 change: 0 additions & 1 deletion nipype/algorithms/tests/test_auto_AddCSVColumn.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..misc import AddCSVColumn


Expand Down
1 change: 0 additions & 1 deletion nipype/algorithms/tests/test_auto_AddCSVRow.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..misc import AddCSVRow


Expand Down
Loading