Skip to content

Commit

Permalink
Merge pull request #4 from nipype/develop
Browse files Browse the repository at this point in the history
Debugging GH actions for auto-conversion from Nipype
  • Loading branch information
tclose authored Mar 19, 2024
2 parents b401283 + 21c393e commit e7d5411
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 202 deletions.
65 changes: 28 additions & 37 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,77 +107,68 @@ jobs:
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 .
pytest ./related-packages -sv --cov fileformats.medimage_afni --cov fileformats.extras.medimage_afni --cov-report xml .
test:
needs: [nipype-conv, fileformats-test]
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.8'] # '3.11'
python-version: ['3.8', '3.11']
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
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Checkout repo
uses: actions/checkout@v3

- 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: Install AFNI
run: |
curl -O https://raw.githubusercontent.com/afni/afni/master/src/other_builds/OS_notes.linux_ubuntu_22_64_a_admin.txt
curl -O https://raw.githubusercontent.com/afni/afni/master/src/other_builds/OS_notes.linux_ubuntu_22_64_b_user.tcsh
sudo bash OS_notes.linux_ubuntu_22_64_a_admin.txt 2>&1 | tee o.ubuntu_22_a.txt
- name: Download tasks converted from Nipype
uses: actions/download-artifact@v3
with:
name: converted-nipype
path: pydra/tasks/afni/auto

- name: Show the contents of the auto-generated tasks
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
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 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
- uses: codecov/codecov-action@v3
pytest -sv ./pydra/tasks/afni --cov pydra.tasks.afni --cov-report xml
- name: Upload to CodeCov
uses: codecov/codecov-action@v3
if: ${{ always() }}
with:
files: coverage.xml,./fileformats/coverage.xml
Expand Down
132 changes: 0 additions & 132 deletions .github/workflows/fileformats-ci-cd.yaml

This file was deleted.

32 changes: 20 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
===============================
===========================
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
.. .. image:: https://codecov.io/gh/nipype/pydra-afni/branch/main/graph/badge.svg?token=UIS0OGPST7
.. :target: https://codecov.io/gh/nipype/pydra-afni
.. image:: https://codecov.io/gh/nipype/pydra-afni/branch/main/graph/badge.svg?token=UIS0OGPST7
:target: https://codecov.io/gh/nipype/pydra-afni
.. image:: https://img.shields.io/pypi/pyversions/pydra-afni.svg
:target: https://pypi.python.org/pypi/pydra-afni/
:alt: Supported Python versions
Expand All @@ -14,10 +14,10 @@ Pydra task package for afni
:alt: Latest Version


This package contains a collection of Pydra task interfaces for the afni toolkit.
The basis of this collection has been formed by the semi-automatic conversion of
existing `Nipype <https://github.com/nipy/nipype>`__ interfaces to Pydra using the
`Nipype2Pydra <https://github.com/nipype/nipype2pydra>`__ tool
This package contains a collection of Pydra task interfaces for the `AFNI <https://afni.nimh.nih.gov/>`__
software toolkit. The basis of this collection has been formed by the semi-automatic
conversion of existing `Nipype <https://github.com/nipy/nipype>`__ interfaces to Pydra
using the `Nipype2Pydra <https://github.com/nipype/nipype2pydra>`__ tool


Automatically-generated vs manually-curated tasks
Expand All @@ -26,8 +26,7 @@ Automatically-generated vs manually-curated tasks
Automatically generated tasks can be found in the `pydra.tasks.afni.auto` package.
These packages should be treated with extreme caution as they likely do not pass testing.
Generated tasks that have been edited and pass testing are imported into one or more of the
`pydra.tasks.afni.v*` packages, corresponding to the version of the afni toolkit
they are designed for.
`pydra.tasks.afni.v*` packages, corresponding to the version of AFNI they are designed for.

Tests
-----
Expand All @@ -39,7 +38,8 @@ the necessary dependencies to run the tests
$ pip install -e .[test]
Then the tests, including `doctests` <https://docs.python.org/3/library/doctest.html>`__, can be launched using
Then the tests, including `doctests` <https://docs.python.org/3/library/doctest.html>`__,
can be launched using

.. code-block::
Expand Down Expand Up @@ -71,14 +71,22 @@ Contributing to this package
Developer installation
~~~~~~~~~~~~~~~~~~~~~~

Install the `fileformats <https://arcanaframework.github.io/fileformats/>`__ packages
corresponding to AFNI specific file formats


.. code-block::
$ pip install -e ./related-packages/fileformats[dev]
$ pip install -e ./related-packages/fileformats-extras[dev]
Install repo in developer mode from the source directory and install pre-commit to
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
4 changes: 2 additions & 2 deletions pydra/tasks/afni/latest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
PACKAGE_VERSION = "v1"
PACKAGE_VERSION = "v24_0_12"

from .v1 import * # noqa
from .v24_0_12 import * # noqa
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pathlib import Path
import typing as ty
from random import Random
from fileformats.core import FileSet
from fileformats.core import FileSet, SampleFileGenerator
from fileformats.medimage_afni import (
OneD,
Head,
Expand All @@ -16,58 +16,46 @@
@FileSet.generate_sample_data.register
def gen_sample_oned_data(
oned: OneD,
dest_dir: Path,
seed: ty.Union[int, Random] = 0,
stem: ty.Optional[str] = None,
generator: SampleFileGenerator,
) -> ty.Iterable[Path]:
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_head_data(
head: Head,
dest_dir: Path,
seed: ty.Union[int, Random] = 0,
stem: ty.Optional[str] = None,
generator: SampleFileGenerator,
) -> ty.Iterable[Path]:
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_all1_data(
all1: All1,
dest_dir: Path,
seed: ty.Union[int, Random] = 0,
stem: ty.Optional[str] = None,
generator: SampleFileGenerator,
) -> ty.Iterable[Path]:
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_r1_data(
r1: R1,
dest_dir: Path,
seed: ty.Union[int, Random] = 0,
stem: ty.Optional[str] = None,
generator: SampleFileGenerator,
) -> ty.Iterable[Path]:
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_threed_data(
threed: ThreeD,
dest_dir: Path,
seed: ty.Union[int, Random] = 0,
stem: ty.Optional[str] = None,
generator: SampleFileGenerator,
) -> ty.Iterable[Path]:
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_dset_data(
dset: Dset,
dest_dir: Path,
seed: ty.Union[int, Random] = 0,
stem: ty.Optional[str] = None,
generator: SampleFileGenerator,
) -> ty.Iterable[Path]:
raise NotImplementedError
Loading

0 comments on commit e7d5411

Please sign in to comment.