diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7402fb47..559eed784 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,36 +66,43 @@ 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 - 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-2.5.2 rm ants.zip - echo "/opt/ants-2.5.1" >> $GITHUB_PATH + echo "/opt/ants-2.5.2" >> $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 - 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="" 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 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`_ diff --git a/junifer/api/tests/test_api_utils.py b/junifer/api/tests/test_api_utils.py index 28ae2ac3a..425fbc013 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, 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 611dde5c3..5d017878f 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, 11): # 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/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) 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) diff --git a/junifer/pipeline/pipeline_step_mixin.py b/junifer/pipeline/pipeline_step_mixin.py index dfad3c795..ae8f6c82f 100644 --- a/junifer/pipeline/pipeline_step_mixin.py +++ b/junifer/pipeline/pipeline_step_mixin.py @@ -4,10 +4,14 @@ # Synchon Mandal # License: AGPL -try: - from importlib.metadata import packages_distributions -except ImportError: # pragma: no cover +import sys + + +if sys.version_info < (3, 11): # pragma: no cover from importlib_metadata import packages_distributions +else: + from importlib.metadata import packages_distributions + from importlib.util import find_spec from itertools import chain 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) 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 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"]