Skip to content

Commit 6baadcc

Browse files
authored
Merge pull request #55 from nipype/add-docs
Add docs to CI/CD
2 parents 8e29e08 + e1d072c commit 6baadcc

File tree

10 files changed

+168
-464
lines changed

10 files changed

+168
-464
lines changed

.github/workflows/ci-cd.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ env:
2020
FSL_VERSION: 6.0.7.9
2121
FSL_HOME: ${{ github.workspace }}/fsl-install
2222

23+
permissions:
24+
contents: read
25+
pages: write
26+
id-token: write
27+
2328
jobs:
2429

2530
nipype-conv:
@@ -387,6 +392,47 @@ jobs:
387392
draft: false
388393
prerelease: false
389394

395+
# docs:
396+
# needs: deploy
397+
# environment:
398+
# name: github-pages
399+
# url: ${{ steps.deployment.outputs.page_url }}
400+
# runs-on: ubuntu-latest
401+
# steps:
402+
# - uses: actions/checkout@v4
403+
# - uses: actions/setup-python@v5
404+
# with:
405+
# python-version: '3.x'
406+
407+
# - name: Download tasks converted from Nipype
408+
# uses: actions/download-artifact@v4
409+
# with:
410+
# name: converted-nipype
411+
# path: pydra/tasks/freesurfer/auto
412+
413+
# - name: Install dependencies
414+
# run: python -m pip install related-packages/fileformats .[doc]
415+
416+
# - name: Build docs
417+
# run: |
418+
# pushd docs
419+
# make html
420+
# popd
421+
422+
# - name: Upload artifact
423+
# uses: actions/upload-pages-artifact@v3
424+
# with:
425+
# path: 'docs/build/html'
426+
427+
# - name: Setup GitHub Pages
428+
# if: github.event_name == 'release' || github.event_name == 'repository_dispatch'
429+
# uses: actions/configure-pages@v4
430+
431+
# - name: Deploy to GitHub Pages
432+
# if: github.event_name == 'release' || github.event_name == 'repository_dispatch'
433+
# id: deployment
434+
# uses: actions/deploy-pages@v4
435+
390436

391437
# report_progress:
392438
# needs: [deploy]

.github/workflows/docs.yaml

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

.github/workflows/publish.yaml

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

.github/workflows/test.yaml

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

README.md

Lines changed: 117 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
[![PyPI - Version][pypi-version]][pypi-project]
44
[![PyPI - Python Version][pypi-pyversions]][pypi-project]
55
[![PyPI - Downloads][pypi-downloads]][pypi-project]
6-
![][status-docs]
7-
![][status-test]
6+
[![Status-docs][status-docs-badge]][status-docs-link]
7+
[![Status-CICD][status-cicd-badge]][status-cicd-link]
88

99
----
1010

@@ -24,7 +24,7 @@ for FMRI, MRI and DTI brain imaging data.
2424
- [Development](#development)
2525
- [License](#license)
2626

27-
## Available tasks
27+
## Tested interfaces
2828

2929
| Module | Tasks |
3030
|--------|--------------------------------------------------------------------------------------------------------------------|
@@ -48,26 +48,126 @@ A separate installation of FSL is required to use this package.
4848
Please review the FSL [installation instructions][fsl-install]
4949
and [licensing details][fsl-license].
5050

51+
52+
## Automatic Conversion
53+
54+
Automatically generated tasks can be found in the `pydra.tasks.fsl.auto` sub-package.
55+
These interfaces should be treated with caution as they likely do not pass testing.
56+
Generated tasks that have been edited and pass testing will be imported into one or more of the
57+
`pydra.tasks.fsl.v*` sub-packages (e.g. `pydra.tasks.fsl.v7_4`) corresponding
58+
to the version of the fsl toolkit they are designed for.
59+
60+
61+
### Continuous integration
62+
63+
This template uses [GitHub Actions](https://docs.github.com/en/actions/) to run tests and
64+
deploy packages to PYPI. New packages are built and uploaded when releases are created on
65+
GitHub, or new releases of Nipype or the Nipype2Pydra conversion tool are released.
66+
Releases triggered by updates to Nipype or Nipype2Pydra are signified by the `postN`
67+
suffix where `N = <nipype-version><nipype2pydra-version>` with the '.'s stripped, e.g.
68+
`v0.2.3post185010` corresponds to the v0.2.3 tag of this repository with auto-generated
69+
packages from Nipype 1.8.5 using Nipype2Pydra 0.1.0.
70+
5171
## Development
5272

53-
This project is managed with [Hatch][hatch]:
73+
### Methodology
74+
75+
The development of this package is expected to have two phases
76+
77+
1. Where the corresponding Nipype interfaces are considered to be the ground truth, and
78+
the Pydra tasks are generated from them
79+
2. When the Pydra tasks are considered be mature and they are edited by hand
80+
81+
Different tasks will probably mature at different times so there will probably be an
82+
intermediate phase between 1 and 2.
83+
84+
### Developer installation
85+
86+
Before the pydra task interfaces can be generated and installed, the file-format classes
87+
[fileformats](https://arcanaframework.github.io/fileformats/) packages
88+
corresponding to FSL specific file formats will need to be installed
89+
90+
```console
91+
pip install -e ./related-packages/fileformats[dev]
92+
pip install -e ./related-packages/fileformats-extras[dev]
93+
```
94+
95+
Next install the requirements for running the auto-conversion script and generate the
96+
Pydra task interfaces from their Nipype counterparts
97+
98+
```console
99+
pip install -r nipype-auto-conv/requirements.txt
100+
```
101+
102+
The run the conversion script to convert Nipype interfaces to Pydra
103+
104+
```console
105+
nipype-auto-conv/generate
106+
```
107+
108+
Install repo in developer mode from the source directory and install pre-commit to
109+
ensure consistent code-style and quality.
110+
111+
```console
112+
pip install -e .[test,dev]
113+
pre-commit install
114+
```
115+
116+
### Auto-conversion phase
117+
118+
The auto-converted Pydra tasks are generated from their corresponding Nipype interface
119+
in combination with "conversion hints" contained in YAML specs
120+
located in `nipype-auto-conv/specs/`. The self-documented conversion specs are
121+
to be edited by hand in order to assist the auto-converter produce valid pydra tasks.
122+
After editing one or more conversion specs the `pydra.tasks.fsl.auto` package should
123+
be regenerated by running
54124

55125
```console
56-
pipx install hatch
126+
nipype-auto-conv/generate
57127
```
58128

59-
To run the test suite:
129+
The tests should be run on the auto-generated tasks to see if they are valid
60130

61131
```console
62-
hatch run test
132+
pytest pydra/tasks/fsl/auto/tests/test_<the-name-of-the-task-you-edited>.py
63133
```
64134

65-
To fix linting issues:
135+
If the test passes you should then edit the `pydra/tasks/fsl/v*/__init__.py` file
136+
to import the auto-generated task interface to signify that it has been validated and is
137+
ready for use, where v* corresponds to the version of FSL that you have tested
138+
it against e.g.
66139

67140
```console
68-
hatch run lint:fix
141+
from pydra.tasks.fsl.auto import <the-task-you-have-validated>
69142
```
70143

144+
and copy the test file `pydra/tasks/fsl/auto/tests/test_<validated-task>.py`
145+
into `pydra/tasks/fsl/v*/tests`.
146+
147+
148+
### File-formats and sample test data
149+
150+
The automatically generated tests will attempt to provided the task instance to be tested
151+
with sensible default values based on the type of the field and any constraints it has
152+
on it. However, these will often need to be manually overridden after consulting the
153+
underlying tool's documentation.
154+
155+
For file-based data, automatically generated file-system objects will be created for
156+
selected format types, e.g. Nifti, Dicom. Therefore, it is important to specify the
157+
format of the file using the "mime-like" string corresponding to a
158+
[fileformats](https://github.com/ArcanaFramework/fileformats) class
159+
in the `inputs > types` and `outputs > types` dicts of the YAML spec.
160+
161+
If the required file-type is not found implemented within fileformats, please see the `fileformats`
162+
docs [https://arcanaframework.github.io/fileformats/developer.html] for instructions on how to define
163+
new fileformat types, and see
164+
[fileformats-medimage-extras](https://github.com/ArcanaFramework/fileformats-medimage-extras/blob/6c2dabe91e95687eebc2639bb6f034cf9595ecfc/fileformats/extras/medimage/nifti.py#L30-L48)
165+
for an example on how to implement methods to generate sample data for them. Implementations of
166+
new fileformats that are specific to FSL, and functions to
167+
generate sample data for them, should be defined in `related-packages/fileformats`
168+
and `related-packages/fileformats-extras`, respectively.
169+
170+
71171
## License
72172

73173
This project is distributed under the terms of the [Apache License, Version 2.0][license].
@@ -92,6 +192,12 @@ This project is distributed under the terms of the [Apache License, Version 2.0]
92192

93193
[fsl-license]: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/Licence
94194

95-
[hatch]: https://hatch.pypa.io/
96-
97195
[license]: https://spdx.org/licenses/Apache-2.0.html
196+
197+
[status-docs-badge]: https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat
198+
199+
[status-cicd-badge]: https://github.com/nipype/pydra-fsl/actions/workflows/ci-cd.yaml/badge.svg
200+
201+
[status-docs-link]: https://nipype.github.io/pydra-fsl/
202+
203+
[status-cicd-link]: https://github.com/nipype/pydra-fsl/actions/workflows/ci-cd.yaml

0 commit comments

Comments
 (0)