Skip to content

Commit 5bbb6df

Browse files
authored
Merge pull request #5 from nipype/nipype-auto-conv
Setting up nipype-auto-converter
2 parents 4319d63 + 77be07e commit 5bbb6df

File tree

139 files changed

+3458
-4806
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+3458
-4806
lines changed

.github/workflows/ci-cd.yaml

Lines changed: 59 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -16,54 +16,55 @@ on:
1616
types: [create-release]
1717

1818
jobs:
19-
2019
nipype-conv:
2120
runs-on: ubuntu-latest
2221
steps:
2322
- name: Checkout
24-
uses: actions/checkout@v3
23+
uses: actions/checkout@v4
2524
- name: Revert version to most recent tag on upstream update
2625
if: github.event_name == 'repository_dispatch'
2726
run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}')
27+
- name: Show file tree
28+
run: tree .
2829
- name: Set up Python ${{ matrix.python-version }}
29-
uses: actions/setup-python@v4
30+
uses: actions/setup-python@v5
3031
- name: Install build dependencies
3132
run: python -m pip install --upgrade pip
3233
- name: Install requirements
33-
run: python -m pip install ./related-packages/fileformats -r ./nipype-auto-conv/requirements.txt
34+
run: python -m pip install -r ./nipype-auto-conv/requirements.txt
3435
- name: Run automatic Nipype > Pydra conversion
3536
run: ./nipype-auto-conv/generate
36-
- uses: actions/upload-artifact@v3
37+
- uses: actions/upload-artifact@v4
3738
with:
3839
name: converted-nipype
39-
path: pydra/tasks/anatomical/auto
40+
path: pydra/tasks/mriqc
4041

4142
devcheck:
4243
needs: [nipype-conv]
4344
runs-on: ubuntu-latest
4445
strategy:
4546
matrix:
46-
python-version: ['3.8', '3.11'] # Check oldest and newest versions
47+
python-version: ['3.10', '3.12'] # Check oldest and newest versions
4748
pip-flags: ['', '--editable']
4849
pydra:
4950
- 'pydra'
5051
- '--editable git+https://github.com/nipype/pydra.git#egg=pydra'
5152
steps:
5253
- name: Checkout
53-
uses: actions/checkout@v3
54+
uses: actions/checkout@v4
5455
- name: Revert version to most recent tag on upstream update
5556
if: github.event_name == 'repository_dispatch'
5657
run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}')
5758
- name: Download tasks converted from Nipype
58-
uses: actions/download-artifact@v3
59+
uses: actions/download-artifact@v4
5960
with:
6061
name: converted-nipype
61-
path: pydra/tasks/anatomical/auto
62+
path: pydra/tasks/mriqc
6263
- name: Strip auto package from gitignore so it is included in package
6364
run: |
64-
sed -i '/\/pydra\/tasks\/anatomical\/auto/d' .gitignore
65+
sed -i '/\/pydra/d' .gitignore
6566
- name: Set up Python ${{ matrix.python-version }}
66-
uses: actions/setup-python@v4
67+
uses: actions/setup-python@v5
6768
with:
6869
python-version: ${{ matrix.python-version }}
6970
- name: Install build dependencies
@@ -77,207 +78,104 @@ jobs:
7778
python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
7879
- name: Install task package
7980
run: |
80-
pip install "./related-packages/fileformats[dev]" "related-packages/fileformats-extras[dev]"
8181
pip install ${{ matrix.pip-flags }} ".[dev]"
82-
python -c "import pydra.tasks.anatomical as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
8382
python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
84-
python -c "import fileformats.medimage_anatomical as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
85-
python -c "import fileformats.extras.medimage_anatomical as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
86-
87-
fileformats-test:
88-
runs-on: ubuntu-latest
89-
strategy:
90-
matrix:
91-
python-version: ['3.8', '3.11']
92-
steps:
93-
- uses: actions/checkout@v3
94-
- name: Revert version to most recent tag on upstream update
95-
if: github.event_name == 'repository_dispatch'
96-
run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}')
97-
- name: Set up Python ${{ matrix.python-version }}
98-
uses: actions/setup-python@v4
99-
with:
100-
python-version: ${{ matrix.python-version }}
101-
- name: Install build dependencies
102-
run: |
103-
python -m pip install --upgrade pip
104-
- name: Install task package
105-
run: |
106-
pip install "./related-packages/fileformats[test]" "./related-packages/fileformats-extras[test]"
107-
python -c "import fileformats.medimage_anatomical as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
108-
- name: Test fileformats with pytest
109-
run: |
110-
cd ./fileformats
111-
pytest -sv --cov fileformats.medimage_anatomical --cov fileformats.extras.medimage_anatomical --cov-report xml .
11283
84+
11385
test:
114-
needs: [nipype-conv, fileformats-test]
86+
needs: [nipype-conv]
11587
runs-on: ubuntu-22.04
11688
strategy:
11789
matrix:
118-
python-version: ['3.8'] # '3.11'
90+
python-version: ['3.10', '3.12']
91+
11992
steps:
93+
12094
- name: Removed unnecessary tools to free space
12195
run: |
12296
sudo rm -rf /usr/share/dotnet
123-
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
124-
- name: Get Download cache Key
125-
id: cache-key
126-
run: echo "::set-output name=key::anatomical-linux-ubuntu22_amd64-7.4.1"
127-
- name: Cache FreeSurfer
128-
uses: actions/cache@v2
129-
with:
130-
path: $HOME/downloads/anatomical
131-
key: ${{ steps.cache-key.outputs.key }}
132-
restore-keys: |
133-
anatomical-linux-ubuntu22_amd64-7.4.1
134-
- name: Download FreeSurfer
135-
if: steps.cache-key.outputs.key != steps.cache-hit.outputs.key
136-
run: |
137-
mkdir -p $HOME/downloads/anatomical
138-
curl -s -o $HOME/downloads/anatomical/anatomical-linux-ubuntu22_amd64-7.4.1.tar.gz https://surfer.nmr.mgh.harvard.edu/pub/dist/anatomical/7.4.1/anatomical-linux-ubuntu22_amd64-7.4.1.tar.gz
139-
shell: bash
140-
- name: Install Freesurfer
141-
env:
142-
FREESURFER_LICENCE: ${{ secrets.FREESURFER_LICENCE }}
143-
run: |
144-
pushd $HOME/downloads/anatomical
145-
tar -zxpf anatomical-linux-ubuntu22_amd64-7.4.1.tar.gz
146-
mv anatomical $HOME/
147-
popd
148-
export FREESURFER_HOME=$HOME/anatomical
149-
source $FREESURFER_HOME/SetUpFreeSurfer.sh
150-
echo $FREESURFER_LICENCE > $FREESURFER_HOME/license.txt
151-
export PATH=$FREESURFER_HOME/bin:$PATH
152-
- uses: actions/checkout@v3
97+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
98+
99+
- uses: actions/checkout@v4
153100
- name: Revert version to most recent tag on upstream update
154101
if: github.event_name == 'repository_dispatch'
155102
run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}')
103+
156104
- name: Download tasks converted from Nipype
157-
uses: actions/download-artifact@v3
105+
uses: actions/download-artifact@v4
158106
with:
159107
name: converted-nipype
160-
path: pydra/tasks/anatomical/auto
161-
- name: Strip auto package from gitignore so it is included in package
108+
path: pydra/tasks/mriqc
109+
110+
- name: Strip pydra package from gitignore so it is included in package
162111
run: |
163-
sed -i '/\/src\/pydra\/tasks\/anatomical\/auto/d' .gitignore
112+
sed -i '/\/pydra/d' .gitignore
113+
164114
- name: Set up Python ${{ matrix.python-version }}
165-
uses: actions/setup-python@v4
115+
uses: actions/setup-python@v5
166116
with:
167117
python-version: ${{ matrix.python-version }}
118+
168119
- name: Install build dependencies
169120
run: |
170121
python -m pip install --upgrade pip
122+
171123
- name: Install task package
172124
run: |
173-
pip install "./related-packages/fileformats" "./related-packages/fileformats-extras" ".[test]"
174-
python -c "import pydra.tasks.anatomical as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
125+
pip install ".[test]"
126+
python -c "import pydra.tasks.mriqc as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
175127
python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
128+
129+
- name: Install dev Pydra version for now until it is merged
130+
run: pip install --upgrade git+https://github.com/nipype/pydra.git@typing-bugfixes
131+
132+
- name: Set environment variables required for mocking tools
133+
run: |
134+
echo "$(pwd)/mock-tools" >> $GITHUB_PATH
135+
echo "export FSLDIR=$(pwd)/mock-tools" >> $GITHUB_ENV
136+
echo "export FSLOUTPUTTYPE=NIFTI_GZ" >> $GITHUB_ENV
137+
176138
- name: Test with pytest
177139
run: |
178-
pytest -sv --doctest-modules ./pydra/tasks/anatomical \
179-
--cov pydra.tasks.anatomical --cov-report xml
140+
pytest -sv ./pydra --cov pydra.tasks.mriqc --cov-report xml
141+
180142
- uses: codecov/codecov-action@v3
181143
if: ${{ always() }}
182144
with:
183-
files: coverage.xml,./fileformats/coverage.xml
184-
name: pydra-anatomical
185-
186-
deploy-fileformats:
187-
needs: [devcheck, test]
188-
runs-on: ubuntu-latest
189-
steps:
190-
- uses: actions/checkout@v3
191-
with:
192-
submodules: recursive
193-
fetch-depth: 0
194-
- name: Set up Python
195-
uses: actions/setup-python@v4
196-
with:
197-
python-version: '3.11'
198-
- name: Install build tools
199-
run: python -m pip install build twine
200-
- name: Build source and wheel distributions
201-
run: python -m build ./related-packages/fileformats
202-
- name: Check distributions
203-
run: twine check ./related-packages/fileformats/dist/*
204-
- name: Check for PyPI token on tag
205-
id: deployable
206-
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || github.event_name == 'repository_dispatch'
207-
env:
208-
PYPI_API_TOKEN: "${{ secrets.PYPI_FILEFORMATS_API_TOKEN }}"
209-
run: if [ -n "$PYPI_API_TOKEN" ]; then echo "DEPLOY=true" >> $GITHUB_OUTPUT; fi
210-
- name: Upload to PyPI
211-
if: steps.deployable.outputs.DEPLOY
212-
uses: pypa/gh-action-pypi-publish@release/v1
213-
with:
214-
user: __token__
215-
password: ${{ secrets.PYPI_FILEFORMATS_API_TOKEN }}
216-
packages-dir: ./related-packages/fileformats/dist
217-
218-
deploy-fileformats-extras:
219-
needs: [deploy-fileformats]
220-
runs-on: ubuntu-latest
221-
steps:
222-
- uses: actions/checkout@v3
223-
with:
224-
submodules: recursive
225-
fetch-depth: 0
226-
- name: Set up Python
227-
uses: actions/setup-python@v4
228-
with:
229-
python-version: '3.11'
230-
- name: Install build tools
231-
run: python -m pip install build twine
232-
- name: Build source and wheel distributions
233-
run: python -m build ./related-packages/fileformats-extras
234-
- name: Check distributions
235-
run: twine check ./related-packages/fileformats-extras/dist/*
236-
- name: Check for PyPI token on tag
237-
id: deployable
238-
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || github.event_name == 'repository_dispatch'
239-
env:
240-
PYPI_API_TOKEN: "${{ secrets.PYPI_FILEFORMATS_EXTRAS_API_TOKEN }}"
241-
run: if [ -n "$PYPI_API_TOKEN" ]; then echo "DEPLOY=true" >> $GITHUB_OUTPUT; fi
242-
- name: Upload to PyPI
243-
if: steps.deployable.outputs.DEPLOY
244-
uses: pypa/gh-action-pypi-publish@release/v1
245-
with:
246-
user: __token__
247-
password: ${{ secrets.PYPI_FILEFORMATS_EXTRAS_API_TOKEN }}
248-
packages-dir: ./related-packages/fileformats-extras/dist
145+
files: coverage.xml
146+
name: pydra-mriqc
249147

250148
deploy:
251-
needs: [deploy-fileformats-extras]
149+
needs: [test]
252150
runs-on: ubuntu-latest
253151
steps:
254-
- uses: actions/checkout@v3
152+
- uses: actions/checkout@v4
255153
with:
256154
submodules: recursive
257155
fetch-depth: 0
258156
- name: Download tasks converted from Nipype
259-
uses: actions/download-artifact@v3
157+
uses: actions/download-artifact@v4
260158
with:
261159
name: converted-nipype
262-
path: pydra/tasks/anatomical/auto
160+
path: pydra/tasks/mriqc
263161
- name: Tag release with a post-release based on Nipype and Nipype2Pydra versions
264162
if: github.event_name == 'repository_dispatch'
265163
run: |
266164
TAG=$(git tag -l | tail -n 1 | awk -F post '{print $1}')
267-
POST=$(python -c "from pydra.tasks.anatomical.auto._version import *; print(post_release)")
165+
POST=$(python -c "from pydra.tasks.mriqc._post_release import *; print(post_release)")
268166
git checkout $TAG
269-
git add -f pydra/tasks/anatomical/auto/_version.py
167+
git add -f pydra/tasks/mriqc/_version.py
270168
git commit -am"added auto-generated version to make new tag for package version"
271169
git tag ${TAG}post${POST}
272170
- name: Set up Python
273-
uses: actions/setup-python@v4
171+
uses: actions/setup-python@v5
274172
with:
275-
python-version: '3.11'
173+
python-version: '3.12'
276174
- name: Install build tools
277175
run: python -m pip install build twine
278-
- name: Strip auto package from gitignore so it is included in package
176+
- name: Strip pydra package from gitignore so it is included in package
279177
run: |
280-
sed -i '/\/pydra\/tasks\/anatomical\/auto/d' .gitignore
178+
sed -i '/\/pydra/d' .gitignore
281179
- name: Build source and wheel distributions
282180
run: python -m build .
283181
- name: Check distributions
@@ -288,7 +186,7 @@ jobs:
288186
path: dist/
289187
- name: Check for PyPI token on tag
290188
id: deployable
291-
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || github.event_name == 'repository_dispatch'
189+
if: github.event_name == 'release'
292190
env:
293191
PYPI_API_TOKEN: "${{ secrets.PYPI_API_TOKEN }}"
294192
run: if [ -n "$PYPI_API_TOKEN" ]; then echo "DEPLOY=true" >> $GITHUB_OUTPUT; fi
@@ -302,4 +200,4 @@ jobs:
302200
# Deploy on tags if PYPI_API_TOKEN is defined in the repository secrets.
303201
# Secrets are not accessible in the if: condition [0], so set an output variable [1]
304202
# [0] https://github.community/t/16928
305-
# [1] https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter
203+
# [1] https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,4 @@ dmypy.json
137137
# Mac garbarge
138138
.DS_store
139139

140-
/pydra/tasks/mriqc/interfaces
141-
/pydra/tasks/mriqc/_version.py
142-
/pydra/tasks/mriqc/auto
140+
/pydra

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Enter list of names and emails of contributors to this package

NOTICE

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Pydra-mriqc
2+
Copyright 2024 Pydra Development Team
3+
4+
The bases for the task interfaces defined in this package were semi-automatically converted
5+
from Nipype interfaces (https://github.com/nipy/nipype) using the Nipype2Pydra tool
6+
(https://github.com/nipype/nipype2pydra).

README.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)