Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 60 additions & 60 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,46 @@ name: CI/CD
on:
push:
branches: [ main, develop ]
tags: [ '*' ]
pull_request:
branches: [ main, develop ]
release:
types: [published]
repository_dispatch:
types: [create-release]
types: [create-post-release]

permissions:
contents: read
pages: write
id-token: write

jobs:

nipype-conv:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v3
- name: Revert version to most recent tag on upstream update
uses: actions/checkout@v4

- name: Revert version to most recent version tag on upstream update
if: github.event_name == 'repository_dispatch'
run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}')
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
run: git checkout $(git tag -l | grep 'v.*' | tail -n 1 | awk -F post '{print $1}')

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install build dependencies
run: python -m pip install --upgrade pip

- name: Install requirements
run: python -m pip install ./related-packages/fileformats -r ./nipype-auto-conv/requirements.txt
run: python -m pip install -r ./nipype-auto-conv/requirements.txt ./related-packages/fileformats

- name: Run automatic Nipype > Pydra conversion
run: ./nipype-auto-conv/generate
- uses: actions/upload-artifact@v3

- uses: actions/upload-artifact@v4
with:
name: converted-nipype
path: pydra/tasks/afni/auto
Expand All @@ -43,43 +58,50 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.11'] # Check oldest and newest versions
python-version: ['3.8', '3.12'] # Check oldest and newest versions
pip-flags: ['', '--editable']
pydra:
- 'pydra'
- '--editable git+https://github.com/nipype/pydra.git#egg=pydra'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Revert version to most recent tag on upstream update
uses: actions/checkout@v4

- name: Revert version to most recent version tag on Nipype or Nipype2Pydra update
if: github.event_name == 'repository_dispatch'
run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}')
- name: Download tasks converted from Nipype
uses: actions/download-artifact@v3
run: git checkout $(git tag -l | grep 'v.*' | tail -n 1 | awk -F post '{print $1}')

- name: Download tasks converted from Nipype
uses: actions/download-artifact@v4
with:
name: converted-nipype
path: pydra/tasks/afni/auto
- name: Strip auto package from gitignore so it is included in package
run: |
sed -i '/\/pydra\/tasks\/afni\/auto/d' .gitignore
sed -i '/^_version.py/d' .gitignore
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install build dependencies
run: |
python -m pip install --upgrade pip

- name: Install Pydra
run: |
pushd $HOME
pip install ${{ matrix.pydra }}
popd
python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"

- name: Install task package
run: |
pip install "./related-packages/fileformats[dev]" "related-packages/fileformats-extras[dev]"
pip install ${{ matrix.pip-flags }} ".[dev]"
python -c "import pydra.tasks.afni as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
python -c "import pydra.tasks.afni.auto as m; print(f'{m.__name__} @ {m.__file__}')"
python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
python -c "import fileformats.medimage_afni as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
python -c "import fileformats.extras.medimage_afni as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
Expand All @@ -88,7 +110,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.11']
python-version: ['3.8', '3.12']
steps:
- uses: actions/checkout@v3
- name: Revert version to most recent tag on upstream update
Expand All @@ -106,77 +128,55 @@ jobs:
pip install "./related-packages/fileformats[test]" "./related-packages/fileformats-extras[test]"
python -c "import fileformats.medimage_afni as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
- name: Test fileformats with pytest
run: |
cd ./fileformats
pytest -sv --cov fileformats.medimage_afni --cov fileformats.extras.medimage_afni --cov-report xml .
run: >-
pytest ./related-packages -sv --cov fileformats.medimage_afni
--cov fileformats.extras.medimage_afni --cov-report xml .

test:
needs: [nipype-conv, fileformats-test]
needs: [nipype-conv]
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.8'] # '3.11'
python-version: ['3.8', '3.12']
steps:
- name: Removed unnecessary tools to free space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Get Download cache Key
id: cache-key
run: echo "::set-output name=key::afni-linux-ubuntu22_amd64-7.4.1"
- name: Cache FreeSurfer
uses: actions/cache@v2
with:
path: $HOME/downloads/afni
key: ${{ steps.cache-key.outputs.key }}
restore-keys: |
afni-linux-ubuntu22_amd64-7.4.1
- name: Download FreeSurfer
if: steps.cache-key.outputs.key != steps.cache-hit.outputs.key
run: |
mkdir -p $HOME/downloads/afni
curl -s -o $HOME/downloads/afni/afni-linux-ubuntu22_amd64-7.4.1.tar.gz https://surfer.nmr.mgh.harvard.edu/pub/dist/afni/7.4.1/afni-linux-ubuntu22_amd64-7.4.1.tar.gz
shell: bash
- name: Install Freesurfer
env:
FREESURFER_LICENCE: ${{ secrets.FREESURFER_LICENCE }}
run: |
pushd $HOME/downloads/afni
tar -zxpf afni-linux-ubuntu22_amd64-7.4.1.tar.gz
mv afni $HOME/
popd
export FREESURFER_HOME=$HOME/afni
source $FREESURFER_HOME/SetUpFreeSurfer.sh
echo $FREESURFER_LICENCE > $FREESURFER_HOME/license.txt
export PATH=$FREESURFER_HOME/bin:$PATH
- uses: actions/checkout@v3

- uses: actions/checkout@v4
- name: Revert version to most recent tag on upstream update
if: github.event_name == 'repository_dispatch'
run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}')
- name: Download tasks converted from Nipype
uses: actions/download-artifact@v3
run: git checkout $(git tag -l | grep 'v.*' | tail -n 1 | awk -F post '{print $1}')

- name: Download tasks converted from Nipype
uses: actions/download-artifact@v4
with:
name: converted-nipype
path: pydra/tasks/afni/auto
- name: Show package contents
run: tree ./pydra
- name: Strip auto package from gitignore so it is included in package
run: |
sed -i '/\/src\/pydra\/tasks\/afni\/auto/d' .gitignore
sed -i '/\/pydra\/tasks\/afni\/auto/d' .gitignore
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install build dependencies
run: |
python -m pip install --upgrade pip

- name: Install task package
run: |
pip install "./related-packages/fileformats" "./related-packages/fileformats-extras" ".[test]"
python -c "import pydra.tasks.afni as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
python -c "import pydra.tasks.afni.auto as m; print(f'{m.__name__} @ {m.__file__}')"
python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
- name: Test with pytest
run: |
pytest -sv --doctest-modules ./pydra/tasks/afni \
--cov pydra.tasks.afni --cov-report xml
pytest -sv ./pydra/tasks/afni --cov pydra.tasks.afni --cov-report xml
- uses: codecov/codecov-action@v3
if: ${{ always() }}
with:
Expand Down Expand Up @@ -256,7 +256,7 @@ jobs:
submodules: recursive
fetch-depth: 0
- name: Download tasks converted from Nipype
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: converted-nipype
path: pydra/tasks/afni/auto
Expand All @@ -282,7 +282,7 @@ jobs:
run: python -m build .
- name: Check distributions
run: twine check dist/*
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: distributions
path: dist/
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,5 @@ dmypy.json
.DS_store

/pydra/tasks/afni/auto
/pydra/tasks/afni/nipype_ports
/pydra/tasks/afni/_version.py
/related-packages/**/_version.py
48 changes: 0 additions & 48 deletions README.md

This file was deleted.

6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
===============================
===========================
Pydra task package for afni
===============================
===========================

.. image:: https://github.com/nipype/pydra-afni/actions/workflows/pythonpackage.yaml/badge.svg
:target: https://github.com/nipype/pydra-afni/actions/workflows/pythonpackage.yaml
Expand Down Expand Up @@ -78,7 +78,7 @@ ensure consistent code-style and quality.
.. code-block::

$ pip install -e .[test,dev]
$ pre-commit install
$ pre-commit install

Next install the requirements for running the auto-conversion script and generate the
Pydra task interfaces from their Nipype counterparts
Expand Down
2 changes: 1 addition & 1 deletion nipype-auto-conv/specs/interfaces/net_corr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ inputs:
# type=file|default=<undefined>: can include a whole brain mask within which to calculate correlation. Otherwise, data should be masked already
weight_ts: generic/file
# type=file|default=<undefined>: input a 1D file WTS of weights that will be applied multiplicatively to each ROI's average time series. WTS can be a column- or row-file of values, but it must have the same length as the input time series volume. If the initial average time series was A[n] for n=0,..,(N-1) time points, then applying a set of weights W[n] of the same length from WTS would produce a new time series: B[n] = A[n] * W[n]
out_file: medimage-afni/ncorr
out_file: medimage-afni/n-corr
# type=file|default=<undefined>: output file name part
metadata:
# dict[str, dict[str, any]] - additional metadata to set on any of the input fields (e.g. out_file: position: 1)
Expand Down
5 changes: 3 additions & 2 deletions pydra/tasks/afni/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
>>> import pydra.engine
>>> import pydra.tasks.afni
"""

from warnings import warn
from pathlib import Path

Expand All @@ -19,15 +20,15 @@
)
if "nipype" not in __version__:
try:
from .auto._version import nipype_version, nipype2pydra_version
from .auto._post_release import src_pkg_version, nipype2pydra_version
except ImportError:
warn(
"Nipype interfaces haven't been automatically converted from their specs in "
f"`nipype-auto-conv`. Please run `{str(pkg_path / 'nipype-auto-conv' / 'generate')}` "
"to generated the converted Nipype interfaces in pydra.tasks.afni.auto"
)
else:
n_ver = nipype_version.replace(".", "_")
n_ver = src_pkg_version.replace(".", "_")
n2p_ver = nipype2pydra_version.replace(".", "_")
__version__ += (
"_" if "+" in __version__ else "+"
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ dependencies = [
"fileformats >=0.8.3",
"fileformats-datascience >=0.1",
"fileformats-medimage >=0.4.1",
"fileformats-medimage-afni"
"fileformats-medimage-afni",
"looseversion"
]
license = {file = "LICENSE"}
authors = [{name = "Nipype developers", email = "neuroimaging@python.org"}]
Expand Down Expand Up @@ -44,6 +45,7 @@ doc = [
"sphinxcontrib-versioning",
]
test = [
"nipype2pydra",
"pytest >= 4.4.0",
"pytest-cov",
"pytest-env",
Expand Down
Loading