From 203daa1cfd04ed13fd5992b6474351dadbcfcdae Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Mon, 4 Oct 2021 09:44:14 -0400 Subject: [PATCH 01/11] CI: Add style checks (missing since Travis got throttled) --- .github/workflows/contrib.yml | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/contrib.yml diff --git a/.github/workflows/contrib.yml b/.github/workflows/contrib.yml new file mode 100644 index 000000000..5e799822b --- /dev/null +++ b/.github/workflows/contrib.yml @@ -0,0 +1,41 @@ +name: Contribution checks + +on: + push: + branches: + - master + - maint/* + pull_request: + branches: + - master + - maint/* + +defaults: + run: + shell: bash + +jobs: + stable: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: ['ubuntu-latest'] + python-version: [3.9] + + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + fetch-depth: 0 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Display Python version + run: python -c "import sys; print(sys.version)" + - name: Install flake8 + run: python -m pip install flake8 + - name: Check fMRIPrep + run: python -m flake8 fmriprep + - name: Check wrapper + run: python -m flake8 wrapper From dc378457446d3838f6cea829b3a56d013903ecdf Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Mon, 4 Oct 2021 09:47:11 -0400 Subject: [PATCH 02/11] STY: Use pkgutil to determine if sentry_sdk is importable --- fmriprep/cli/parser.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fmriprep/cli/parser.py b/fmriprep/cli/parser.py index a0932e109..20e453328 100644 --- a/fmriprep/cli/parser.py +++ b/fmriprep/cli/parser.py @@ -635,9 +635,8 @@ def parse_args(args=None, namespace=None): config.from_dict(vars(opts)) if not config.execution.notrack: - try: - import sentry_sdk - except ImportError: + import pkgutil + if pkgutil.find_loader("sentry_sdk") is None: config.execution.notrack = True config.loggers.cli.warning("Telemetry disabled because sentry_sdk is not installed.") else: From 626aede7b98566c22d55a138911787efa183741d Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Mon, 4 Oct 2021 10:00:16 -0400 Subject: [PATCH 03/11] CI: Drop Travis config --- .travis.yml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 55f601d85..000000000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -# vim ft=yaml -language: python -sudo: false -cache: - directories: - - $HOME/.cache/pip - -python: - - 3.7 - -before_install: - - python -m pip install --upgrade pip - - pip install flake8 - -script: - - flake8 fmriprep wrapper From ede646fd95b7035090d59139962eeebee311cf0f Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Tue, 5 Oct 2021 09:23:07 -0400 Subject: [PATCH 04/11] ENH: Allow _build_parser() to pass kwargs to ArgumentParser --- fmriprep/cli/parser.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fmriprep/cli/parser.py b/fmriprep/cli/parser.py index 20e453328..250c20280 100644 --- a/fmriprep/cli/parser.py +++ b/fmriprep/cli/parser.py @@ -5,7 +5,7 @@ from .. import config -def _build_parser(): +def _build_parser(**kwargs): """Build parser object.""" from functools import partial from pathlib import Path @@ -92,6 +92,7 @@ def _slice_time_ref(value, parser): config.environment.version ), formatter_class=ArgumentDefaultsHelpFormatter, + **kwargs, ) PathExists = partial(_path_exists, parser=parser) IsFile = partial(_is_file, parser=parser) From 031bc75556d24f7f603cb9b33ecb47e0f06eb826 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Tue, 5 Oct 2021 09:23:49 -0400 Subject: [PATCH 05/11] TEST: Add test for parsing slice_time_reference options --- fmriprep/cli/tests/test_parser.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/fmriprep/cli/tests/test_parser.py b/fmriprep/cli/tests/test_parser.py index 3555af361..56dc56718 100644 --- a/fmriprep/cli/tests/test_parser.py +++ b/fmriprep/cli/tests/test_parser.py @@ -4,6 +4,7 @@ from ..parser import _build_parser from .. import version as _version from ... import config +from ...tests.test_config import _reset_config MIN_ARGS = ["data/", "out/", "participant"] @@ -139,3 +140,19 @@ def test_bids_filter_file(tmp_path, capsys): err = capsys.readouterr().err assert "JSON syntax error in:" in err + _reset_config() + + +@pytest.mark.parametrize("st_ref", (None, "0", "1", "0.5", "start", "middle")) +def test_slice_time_ref(tmp_path, st_ref): + bids_path = tmp_path / "data" + out_path = tmp_path / "out" + args = [str(bids_path), str(out_path), "participant"] + if st_ref: + args.extend(["--slice-time-ref", st_ref]) + bids_path.mkdir() + + parser = _build_parser() + + parser.parse_args(args) + _reset_config() From c2d5e99877acc23f7aac5b27e4972910e269006d Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Tue, 5 Oct 2021 09:27:48 -0400 Subject: [PATCH 06/11] FIX: Make partially applied "type" for --slice-time-ref --- fmriprep/cli/parser.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fmriprep/cli/parser.py b/fmriprep/cli/parser.py index 250c20280..989e42c33 100644 --- a/fmriprep/cli/parser.py +++ b/fmriprep/cli/parser.py @@ -98,6 +98,7 @@ def _slice_time_ref(value, parser): IsFile = partial(_is_file, parser=parser) PositiveInt = partial(_min_one, parser=parser) BIDSFilter = partial(_bids_filter, parser=parser) + SliceTimeRef = partial(_slice_time_ref, parser=parser) # Arguments as specified by BIDS-Apps # required, positional arguments @@ -336,7 +337,7 @@ def _slice_time_ref(value, parser): required=False, action="store", default=None, - type=_slice_time_ref, + type=SliceTimeRef, help="The time of the reference slice to correct BOLD values to, as a fraction " "acquisition time. 0 indicates the start, 0.5 the midpoint, and 1 the end " "of acquisition. The alias `start` corresponds to 0, and `middle` to 0.5. " From 56893d17448399292aab481b4e60793c51c600f9 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Tue, 5 Oct 2021 17:12:00 -0400 Subject: [PATCH 07/11] DOC: Explain kwargs in _build_parser --- fmriprep/cli/parser.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fmriprep/cli/parser.py b/fmriprep/cli/parser.py index 989e42c33..7edf2f52b 100644 --- a/fmriprep/cli/parser.py +++ b/fmriprep/cli/parser.py @@ -6,7 +6,10 @@ def _build_parser(**kwargs): - """Build parser object.""" + """Build parser object. + + ``kwargs`` are passed to ``argparse.ArgumentParser`` (mainly useful for debugging). + """ from functools import partial from pathlib import Path from argparse import ( From 6e2da9b09c26264a8df8a3f19bf21e659bdde592 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sat, 9 Oct 2021 08:31:59 -0400 Subject: [PATCH 08/11] DOC: 20.2.5 changelog --- CHANGES.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index d7cbe881a..540e84d74 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,15 @@ +20.2.5 (October 11, 2021) +========================= +Bug-fix release in the 20.2.x LTS series. + +This release includes a fix to `--slice-time-ref` parsing. Also, some +issues in anatomical processing are resolved, including poorly-interpolated +labels in aseg segmentations, and probabilistic segmentations have reverted +to FAST. + + * FIX: --slice-time-ref option parsing (#2573) + * CI: Add style checks (missing since Travis got throttled) (#2570) + 20.2.4 (October 04, 2021) ========================= Bug-fix release in the 20.2.x LTS series. From 4e37b9d3cb4f8ba11e7be878ab23223ad692c748 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sat, 9 Oct 2021 08:32:37 -0400 Subject: [PATCH 09/11] PIN: smriprep 0.7.2 --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 734dcb4d3..81aa31528 100644 --- a/setup.cfg +++ b/setup.cfg @@ -38,7 +38,7 @@ install_requires = requests scikit-image ~= 0.17.2 sdcflows ~= 1.3.2 - smriprep ~= 0.7.0 + smriprep ~= 0.7.2 tedana == 0.0.9a1 templateflow >= 0.6 toml From ff02c027375c8cfbe70cfeb301184a216001e167 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Tue, 12 Oct 2021 08:09:32 -0400 Subject: [PATCH 10/11] DOC: Update 20.2.5 release date --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 540e84d74..2aaef9ba5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,4 +1,4 @@ -20.2.5 (October 11, 2021) +20.2.5 (October 12, 2021) ========================= Bug-fix release in the 20.2.x LTS series. From b1c9b60b8b9dd971b17a20d35e513366bf65d5d2 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Tue, 12 Oct 2021 09:19:04 -0400 Subject: [PATCH 11/11] CI: Run full workflows on tags [skip ds005] --- .circleci/config.yml | 55 ++++++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1fe9bcaa5..f4aa02680 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,7 +17,10 @@ jobs: - run: name: Check whether build should be skipped command: | - if [[ "$( git log --format='format:%s' -n 1 $CIRCLE_SHA1 | grep -i -E '^docs?(\(\w+\))?:' )" != "" ]]; then + set -x +e + COMMIT_MSG="$(git log --format='format:%s' -n 1 $CIRCLE_SHA1)" + DOCBUILD="$(echo ${COMMIT_MSG} | grep -i -E '^docs?(\(\w+\))?:')" + if [ -z "$CIRCLE_TAG" -a -n "$DOCBUILD" ]; then echo "Only docs build" circleci step halt fi @@ -248,11 +251,15 @@ jobs: name: Check whether build should be skipped command: | cd /home/circleci/src/fmriprep - if [[ "$( git log --format='format:%s' -n 1 $CIRCLE_SHA1 | grep -i -E '^docs?(\(\w+\))?:' )" != "" ]]; then + set -x +e + COMMIT_MSG="$(git log --format='format:%s' -n 1 $CIRCLE_SHA1)" + DOCBUILD="$(echo ${COMMIT_MSG} | grep -i -E '^docs?(\(\w+\))?:')" + SKIP_PYTEST="$(echo ${COMMIT_MSG} | grep -i -E '\[skip[ _]?tests\]')" + if [ -z "$CIRCLE_TAG" -a -n "$DOCBUILD" ]; then echo "Only docs build" circleci step halt fi - if [[ "$( git log --format=oneline -n 1 $CIRCLE_SHA1 | grep -i -E '\[skip[ _]?tests\]' )" != "" ]]; then + if [ -z "$CIRCLE_TAG" -a -n "$SKIP_PYTEST" ]; then echo "Skipping pytest job" circleci step halt fi @@ -343,18 +350,23 @@ jobs: - checkout: path: /home/circleci/src/fmriprep - run: - name: Check whether build should be skipped + name: Check whether build should be skipped or fast-tracked command: | cd /home/circleci/src/fmriprep - if [[ "$( git log --format='format:%s' -n 1 $CIRCLE_SHA1 | grep -i -E '^docs?(\(\w+\))?:' )" != "" ]]; then + set -x +e + COMMIT_MSG="$(git log --format='format:%s' -n 1 $CIRCLE_SHA1)" + DOCBUILD="$(echo ${COMMIT_MSG} | grep -i -E '^docs?(\(\w+\))?:' )" + SKIP_DS005="$(echo ${COMMIT_MSG} | grep -i -E '\[skip[ _]?ds005\]' )" + NO_FASTTRACK="$(echo ${COMMIT_MSG} | grep -i -E '\[no[ _-]?fasttrack\]' )" + if [ -z "$CIRCLE_TAG" -a -n "$DOCBUILD" ]; then echo "Only docs build" circleci step halt fi - if [[ "$( git log --format=oneline -n 1 $CIRCLE_SHA1 | grep -i -E '\[skip[ _]?ds005\]' )" != "" ]]; then + if [ -z "$CIRCLE_TAG" -a -n "$SKIP_DS005" ]; then echo "Skipping ds000005 build" circleci step halt fi - if [[ "$( git log --format=oneline -n 1 $CIRCLE_SHA1 | grep -i -E '\[no[ _-]?fasttrack\]' )" != "" ]]; then + if [[ -n "$NO_FASTTRACK" ]]; then touch /tmp/.nofasttrack echo "Anatomical fasttrack reusing sMRIPrep's derivatives will not be used." fi @@ -580,11 +592,15 @@ jobs: name: Check whether build should be skipped command: | cd /home/circleci/src/fmriprep - if [[ "$( git log --format='format:%s' -n 1 $CIRCLE_SHA1 | grep -i -E '^docs?(\(\w+\))?:' )" != "" ]]; then + set -x +e + COMMIT_MSG="$(git log --format='format:%s' -n 1 $CIRCLE_SHA1)" + DOCBUILD="$(echo ${COMMIT_MSG} | grep -i -E '^docs?(\(\w+\))?:')" + SKIP_DS054="$(echo ${COMMIT_MSG} | grep -i -E '\[skip[ _]?ds054\]' )" + if [ -z "$CIRCLE_TAG" -a -n "$DOCBUILD" ]; then echo "Only docs build" circleci step halt fi - if [[ "$( git log --format=oneline -n 1 $CIRCLE_SHA1 | grep -i -E '\[skip[ _]?ds054\]' )" != "" ]]; then + if [ -z "$CIRCLE_TAG" -a -n "$SKIP_DS054" ]; then echo "Skipping ds000054 build" circleci step halt fi @@ -743,11 +759,15 @@ jobs: name: Check whether build should be skipped command: | cd /home/circleci/src/fmriprep - if [[ "$( git log --format='format:%s' -n 1 $CIRCLE_SHA1 | grep -i -E '^docs?(\(\w+\))?:' )" != "" ]]; then + set -x +e + COMMIT_MSG="$(git log --format='format:%s' -n 1 $CIRCLE_SHA1)" + DOCBUILD="$(echo ${COMMIT_MSG} | grep -i -E '^docs?(\(\w+\))?:')" + SKIP_DS210="$(echo ${COMMIT_MSG} | grep -i -E '\[skip[ _]?ds054\]' )" + if [ -z "$CIRCLE_TAG" -a -n "$DOCBUILD" ]; then echo "Only docs build" circleci step halt fi - if [[ "$( git log --format=oneline -n 1 $CIRCLE_SHA1 | grep -i -E '\[skip[ _]?ds210\]' )" != "" ]]; then + if [ -z "$CIRCLE_TAG" -a -n "$SKIP_DS210" ]; then echo "Skipping ds000210 build" circleci step halt fi @@ -888,14 +908,6 @@ jobs: fi - checkout: path: /home/circleci/src/fmriprep - - run: - name: Check whether build should be skipped - command: | - cd /home/circleci/src/fmriprep - if [[ "$( git log --format='format:%s' -n 1 $CIRCLE_SHA1 | grep -i -E '^docs?(\(\w+\))?:' )" != "" ]]; then - echo "Only docs build" - circleci step halt - fi - restore_cache: keys: - build-v4-{{ .Branch }}-{{ epoch }} @@ -946,7 +958,10 @@ jobs: name: Check whether build should be skipped command: | cd /home/circleci/src/fmriprep - if [[ "$( git log --format='format:%s' -n 1 $CIRCLE_SHA1 | grep -i -E '^docs?(\(\w+\))?:' )" != "" ]]; then + set -x +e + COMMIT_MSG="$(git log --format='format:%s' -n 1 $CIRCLE_SHA1)" + DOCBUILD="$(echo ${COMMIT_MSG} | grep -i -E '^docs?(\(\w+\))?:')" + if [ -z "$CIRCLE_TAG" -a -n "$DOCBUILD" ]; then echo "Only docs build" circleci step halt fi