From e928f9e585da01080d90d8f8e102612d31dc69bc Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Tue, 18 Jun 2024 16:40:22 +0200 Subject: [PATCH 01/15] fix: correct file name for ReHo output via AFNI --- junifer/markers/reho/_afni_reho.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/junifer/markers/reho/_afni_reho.py b/junifer/markers/reho/_afni_reho.py index c1eb8d88e..514823740 100644 --- a/junifer/markers/reho/_afni_reho.py +++ b/junifer/markers/reho/_afni_reho.py @@ -181,7 +181,7 @@ class AFNIReHo: convert_cmd = [ "3dAFNItoNIFTI", f"-prefix {reho_afni_to_nifti_out_path.resolve()}", - f"{reho_out_path_prefix}+tlrc.BRIK", + f"{reho_out_path_prefix}+orig.BRIK", ] # Call 3dAFNItoNIFTI run_ext_cmd(name="3dAFNItoNIFTI", cmd=convert_cmd) -- 2.52.0 From 3c781d9579aba840b763e40918136dcbffaf9f81 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Tue, 18 Jun 2024 16:40:51 +0200 Subject: [PATCH 02/15] fix: correct file name for ALFF + fALFF outputs via AFNI --- junifer/markers/falff/_afni_falff.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/junifer/markers/falff/_afni_falff.py b/junifer/markers/falff/_afni_falff.py index 31e59c1d6..89d39d5f3 100644 --- a/junifer/markers/falff/_afni_falff.py +++ b/junifer/markers/falff/_afni_falff.py @@ -124,7 +124,7 @@ class AFNIALFF: convert_alff_cmd = [ "3dAFNItoNIFTI", f"-prefix {alff_afni_to_nifti_out_path.resolve()}", - f"{alff_falff_out_path_prefix}_ALFF+tlrc.BRIK", + f"{alff_falff_out_path_prefix}_ALFF+orig.BRIK", ] # Call 3dAFNItoNIFTI run_ext_cmd(name="3dAFNItoNIFTI", cmd=convert_alff_cmd) @@ -136,7 +136,7 @@ class AFNIALFF: convert_falff_cmd = [ "3dAFNItoNIFTI", f"-prefix {falff_afni_to_nifti_out_path.resolve()}", - f"{alff_falff_out_path_prefix}_fALFF+tlrc.BRIK", + f"{alff_falff_out_path_prefix}_fALFF+orig.BRIK", ] # Call 3dAFNItoNIFTI run_ext_cmd(name="3dAFNItoNIFTI", cmd=convert_falff_cmd) -- 2.52.0 From 5c119ab62a7157323179ff97803877af9cfe7b39 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Wed, 19 Jun 2024 10:57:10 +0200 Subject: [PATCH 03/15] fix: correct file name for smoothing output via AFNI --- junifer/preprocess/smoothing/_afni_smoothing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/junifer/preprocess/smoothing/_afni_smoothing.py b/junifer/preprocess/smoothing/_afni_smoothing.py index 50fd27161..9393859e6 100644 --- a/junifer/preprocess/smoothing/_afni_smoothing.py +++ b/junifer/preprocess/smoothing/_afni_smoothing.py @@ -105,7 +105,7 @@ class AFNISmoothing: convert_cmd = [ "3dAFNItoNIFTI", f"-prefix {blur_afni_to_nifti_out_path.resolve()}", - f"{blur_out_path_prefix}+tlrc.BRIK", + f"{blur_out_path_prefix}+orig.BRIK", ] # Call 3dAFNItoNIFTI run_ext_cmd(name="3dAFNItoNIFTI", cmd=convert_cmd) -- 2.52.0 From bc43a14a14328dde0d3cfb05f088cc090cd69704 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Thu, 20 Jun 2024 09:40:23 +0200 Subject: [PATCH 04/15] fix: tweak importlib_metadata backport usage for PipelineStepMixin --- junifer/pipeline/pipeline_step_mixin.py | 7 ++++--- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/junifer/pipeline/pipeline_step_mixin.py b/junifer/pipeline/pipeline_step_mixin.py index dfad3c795..4586a08dd 100644 --- a/junifer/pipeline/pipeline_step_mixin.py +++ b/junifer/pipeline/pipeline_step_mixin.py @@ -4,10 +4,11 @@ # Synchon Mandal # License: AGPL -try: - from importlib.metadata import packages_distributions -except ImportError: # pragma: no cover +try: # pragma: no cover from importlib_metadata import packages_distributions +except ImportError: + from importlib.metadata import packages_distributions + from importlib.util import find_spec from itertools import chain diff --git a/pyproject.toml b/pyproject.toml index 7a17e6aa3..e9389fd0a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,7 @@ dependencies = [ "tqdm==4.66.1", "templateflow>=23.0.0", "lapy>=1.0.0,<2.0.0", - "importlib_metadata; python_version<'3.10'", + "importlib_metadata; python_version<'3.9'", "looseversion==1.3.0; python_version>='3.12'", ] dynamic = ["version"] -- 2.52.0 From 2b4bd9b38fca551482566d63f85f91512b535584 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Thu, 20 Jun 2024 10:25:42 +0200 Subject: [PATCH 05/15] update: fix test in test_api_utils.py --- junifer/api/tests/test_api_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/junifer/api/tests/test_api_utils.py b/junifer/api/tests/test_api_utils.py index 28ae2ac3a..d3cc79c6a 100644 --- a/junifer/api/tests/test_api_utils.py +++ b/junifer/api/tests/test_api_utils.py @@ -4,6 +4,7 @@ # License: AGPL import platform as pl +import sys import pytest @@ -49,8 +50,7 @@ def test_get_dependency_information_short() -> None: "looseversion", ] - python_minor_version = int(pl.python_version_tuple()[1]) - if python_minor_version < 10: + if sys.version_info < (3, 9): dependency_list.append("importlib_metadata") assert frozenset(dependency_information.keys()) == frozenset( -- 2.52.0 From 1c5e387f97e4fcf9678488e02d2695305b781c5e Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Thu, 20 Jun 2024 11:35:19 +0200 Subject: [PATCH 06/15] update: use version conditional instead of try...except for backports --- junifer/markers/brainprint.py | 9 ++++++--- junifer/pipeline/pipeline_step_mixin.py | 7 +++++-- junifer/utils/logging.py | 8 +++++--- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/junifer/markers/brainprint.py b/junifer/markers/brainprint.py index 611dde5c3..72050cd5c 100644 --- a/junifer/markers/brainprint.py +++ b/junifer/markers/brainprint.py @@ -3,10 +3,13 @@ # Authors: Synchon Mandal # License: AGPL -try: - from importlib.metadata import packages_distributions -except ImportError: # pragma: no cover +import sys + + +if sys.version_info < (3, 9): # pragma: no cover from importlib_metadata import packages_distributions +else: + from importlib.metadata import packages_distributions import uuid from copy import deepcopy diff --git a/junifer/pipeline/pipeline_step_mixin.py b/junifer/pipeline/pipeline_step_mixin.py index 4586a08dd..65ae1a381 100644 --- a/junifer/pipeline/pipeline_step_mixin.py +++ b/junifer/pipeline/pipeline_step_mixin.py @@ -4,9 +4,12 @@ # Synchon Mandal # License: AGPL -try: # pragma: no cover +import sys + + +if sys.version_info < (3, 9): # pragma: no cover from importlib_metadata import packages_distributions -except ImportError: +else: from importlib.metadata import packages_distributions diff --git a/junifer/utils/logging.py b/junifer/utils/logging.py index c2b20331a..2589a93c9 100644 --- a/junifer/utils/logging.py +++ b/junifer/utils/logging.py @@ -4,13 +4,15 @@ # Synchon Mandal # License: AGPL -try: +import sys + + +if sys.version_info < (3, 12): from distutils.version import LooseVersion -except ImportError: # pragma: no cover +else: # pragma: no cover from looseversion import LooseVersion import logging -import sys from pathlib import Path from subprocess import PIPE, Popen, TimeoutExpired from typing import Dict, NoReturn, Optional, Type, Union -- 2.52.0 From eb0dd85ff2efea3b08f5ebc73de6b8de03bb1d10 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Thu, 20 Jun 2024 11:37:38 +0200 Subject: [PATCH 07/15] ci: allow continuation on error for external tools in ci.yml --- .github/workflows/ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7402fb47..7782bec24 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,10 +66,14 @@ jobs: sudo tcsh @update.afni.binaries -package linux_ubuntu_16_64 -bindir /afni echo "/afni" >> $GITHUB_PATH if: matrix.python-version == 3.11 + # Bypass AFNI installation failure + continue-on-error: true - name: Check AFNI run: | echo "Using AFNI : $(afni --version)" if: matrix.python-version == 3.11 + # Bypass AFNI installation failure + continue-on-error: true - name: Install ANTs run: | sudo apt-get install -y -qq unzip @@ -79,10 +83,14 @@ jobs: rm ants.zip echo "/opt/ants-2.5.1" >> $GITHUB_PATH if: matrix.python-version == 3.11 + # Bypass ANTs installation failure + continue-on-error: true - name: Check ANTs run: | echo "Using ANTs : $(antsRegistration --version)" if: matrix.python-version == 3.11 + # Bypass ANTs installation failure + continue-on-error: true - name: Install FSL run: | sudo apt-get install -y -qq python3 -- 2.52.0 From ba42896356d649b55280294fce47e5eca76df51c Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Thu, 20 Jun 2024 11:39:05 +0200 Subject: [PATCH 08/15] ci: update ANTs version to 2.5.2 in ci.yml --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7782bec24..76407d217 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,11 +77,11 @@ jobs: - name: Install ANTs run: | sudo apt-get install -y -qq unzip - curl -fsSL -o ants.zip https://github.com/ANTsX/ANTs/releases/download/v2.5.1/ants-2.5.1-ubuntu-22.04-X64-gcc.zip + curl -fsSL -o ants.zip https://github.com/ANTsX/ANTs/releases/download/v2.5.2/ants-2.5.2-ubuntu-22.04-X64-gcc.zip unzip ants.zip -d /opt - mv /opt/ants-2.5.1/bin/* /opt/ants-2.5.1 + mv /opt/ants-2.5.2/bin/* /opt/ants rm ants.zip - echo "/opt/ants-2.5.1" >> $GITHUB_PATH + echo "/opt/ants" >> $GITHUB_PATH if: matrix.python-version == 3.11 # Bypass ANTs installation failure continue-on-error: true -- 2.52.0 From cd7d03b3b233561b124b751aa324cb692b9d92fc Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Thu, 20 Jun 2024 11:39:36 +0200 Subject: [PATCH 09/15] ci: allow latest version installation for FSL in ci.yml --- .github/workflows/ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76407d217..f1d508780 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -93,12 +93,11 @@ jobs: continue-on-error: true - name: Install FSL run: | - sudo apt-get install -y -qq python3 - curl -fsSL https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/releases/fslinstaller.py | python3 - -d /opt/fsl-6.0.6.4 -V 6.0.6.4 + curl -fsSL https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/releases/fslinstaller.py | python - -d /opt/fsl/ FSLOUTPUTTYPE="NIFTI_GZ" FSLMULTIFILEQUIT="TRUE" - FSLTCLSH="/opt/fsl-6.0.6.4/bin/fsltclsh" - FSLWISH="/opt/fsl-6.0.6.4/bin/fslwish" + FSLTCLSH="/opt/fsl/bin/fsltclsh" + FSLWISH="/opt/fsl/bin/fslwish" FSLLOCKDIR="" FSLMACHINELIST="" FSLREMOTECALL="" -- 2.52.0 From ceb8fbf1d175c495bd154f38f8e29f9b43ebf970 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Thu, 20 Jun 2024 11:54:43 +0200 Subject: [PATCH 10/15] ci: fix ANTs installation in ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1d508780..571df2538 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,9 +79,9 @@ jobs: sudo apt-get install -y -qq unzip curl -fsSL -o ants.zip https://github.com/ANTsX/ANTs/releases/download/v2.5.2/ants-2.5.2-ubuntu-22.04-X64-gcc.zip unzip ants.zip -d /opt - mv /opt/ants-2.5.2/bin/* /opt/ants + mv /opt/ants-2.5.2/bin/* /opt/ants-2.5.2 rm ants.zip - echo "/opt/ants" >> $GITHUB_PATH + echo "/opt/ants-2.5.2" >> $GITHUB_PATH if: matrix.python-version == 3.11 # Bypass ANTs installation failure continue-on-error: true -- 2.52.0 From ff3e590e7b032d63704a601ab3d143a0ef01d5b7 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Thu, 20 Jun 2024 11:54:59 +0200 Subject: [PATCH 11/15] ci: fix FSL installation in ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 571df2538..559eed784 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,7 +102,7 @@ jobs: FSLMACHINELIST="" FSLREMOTECALL="" FSLGECUDAQ="cuda.q" - echo "/opt/fsl-6.0.6.4" >> $GITHUB_PATH + echo "/opt/fsl" >> $GITHUB_PATH if: matrix.python-version == 3.11 # Bypass FSL installation failure continue-on-error: true -- 2.52.0 From 50416dadcb83e6dd3ff7145ea6342a2d8d38ba25 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Thu, 20 Jun 2024 11:55:17 +0200 Subject: [PATCH 12/15] fix: correct conditional for backport in PipelineStepMixin --- junifer/pipeline/pipeline_step_mixin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/junifer/pipeline/pipeline_step_mixin.py b/junifer/pipeline/pipeline_step_mixin.py index 65ae1a381..45201f762 100644 --- a/junifer/pipeline/pipeline_step_mixin.py +++ b/junifer/pipeline/pipeline_step_mixin.py @@ -7,7 +7,7 @@ import sys -if sys.version_info < (3, 9): # pragma: no cover +if sys.version_info < (3, 10): # pragma: no cover from importlib_metadata import packages_distributions else: from importlib.metadata import packages_distributions -- 2.52.0 From 85d60ba111d79a473099f8b9bb8392105bc8183f Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Thu, 20 Jun 2024 11:59:06 +0200 Subject: [PATCH 13/15] fix: correct conditional for backport in Brainprint --- junifer/markers/brainprint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/junifer/markers/brainprint.py b/junifer/markers/brainprint.py index 72050cd5c..cf7977ef6 100644 --- a/junifer/markers/brainprint.py +++ b/junifer/markers/brainprint.py @@ -6,7 +6,7 @@ import sys -if sys.version_info < (3, 9): # pragma: no cover +if sys.version_info < (3, 10): # pragma: no cover from importlib_metadata import packages_distributions else: from importlib.metadata import packages_distributions -- 2.52.0 From 9c86ab28a8c0fac4d83fbf116edbbbe4359cac07 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Thu, 20 Jun 2024 14:44:28 +0200 Subject: [PATCH 14/15] fix: adjust conditional backport to allow python 3.9 and python 3.10 --- junifer/api/tests/test_api_utils.py | 2 +- junifer/markers/brainprint.py | 2 +- junifer/pipeline/pipeline_step_mixin.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/junifer/api/tests/test_api_utils.py b/junifer/api/tests/test_api_utils.py index d3cc79c6a..425fbc013 100644 --- a/junifer/api/tests/test_api_utils.py +++ b/junifer/api/tests/test_api_utils.py @@ -50,7 +50,7 @@ def test_get_dependency_information_short() -> None: "looseversion", ] - if sys.version_info < (3, 9): + if sys.version_info < (3, 11): dependency_list.append("importlib_metadata") assert frozenset(dependency_information.keys()) == frozenset( diff --git a/junifer/markers/brainprint.py b/junifer/markers/brainprint.py index cf7977ef6..5d017878f 100644 --- a/junifer/markers/brainprint.py +++ b/junifer/markers/brainprint.py @@ -6,7 +6,7 @@ import sys -if sys.version_info < (3, 10): # pragma: no cover +if sys.version_info < (3, 11): # pragma: no cover from importlib_metadata import packages_distributions else: from importlib.metadata import packages_distributions diff --git a/junifer/pipeline/pipeline_step_mixin.py b/junifer/pipeline/pipeline_step_mixin.py index 45201f762..ae8f6c82f 100644 --- a/junifer/pipeline/pipeline_step_mixin.py +++ b/junifer/pipeline/pipeline_step_mixin.py @@ -7,7 +7,7 @@ import sys -if sys.version_info < (3, 10): # pragma: no cover +if sys.version_info < (3, 11): # pragma: no cover from importlib_metadata import packages_distributions else: from importlib.metadata import packages_distributions -- 2.52.0 From 8d0956c13fbb620ab73ac617f7e575c1ad9960a9 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Thu, 20 Jun 2024 15:46:37 +0200 Subject: [PATCH 15/15] chore: add changelog 318.misc --- docs/changes/newsfragments/318.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/changes/newsfragments/318.misc diff --git a/docs/changes/newsfragments/318.misc b/docs/changes/newsfragments/318.misc new file mode 100644 index 000000000..57ca912e1 --- /dev/null +++ b/docs/changes/newsfragments/318.misc @@ -0,0 +1 @@ +Improve CI to allow external tool installation to fail gracefully and update necessary dependency version and conditional checks by `Synchon Mandal`_ -- 2.52.0