Skip to content

Commit be62545

Browse files
committed
setup docs build
1 parent 8e29e08 commit be62545

File tree

10 files changed

+171
-453
lines changed

10 files changed

+171
-453
lines changed

.github/workflows/ci-cd.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,47 @@ jobs:
387387
draft: false
388388
prerelease: false
389389

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

391432
# report_progress:
392433
# 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: 128 additions & 9 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,137 @@ 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+
## Installation
52+
53+
```console
54+
pip install pydra-fsl
55+
```
56+
57+
A separate installation of FreeSurfer is required to use this package.
58+
Please review the following [instructions][fsl-install]
59+
and [licensing details][fsl-license].
60+
61+
## Automatic Conversion
62+
63+
Automatically generated tasks can be found in the `pydra.tasks.fsl.auto` sub-package.
64+
These interfaces should be treated with caution as they likely do not pass testing.
65+
Generated tasks that have been edited and pass testing will be imported into one or more of the
66+
`pydra.tasks.fsl.v*` sub-packages (e.g. `pydra.tasks.fsl.v7_4`) corresponding
67+
to the version of the fsl toolkit they are designed for.
68+
69+
70+
### Continuous integration
71+
72+
This template uses [GitHub Actions](https://docs.github.com/en/actions/) to run tests and
73+
deploy packages to PYPI. New packages are built and uploaded when releases are created on
74+
GitHub, or new releases of Nipype or the Nipype2Pydra conversion tool are released.
75+
Releases triggered by updates to Nipype or Nipype2Pydra are signified by the `postN`
76+
suffix where `N = <nipype-version><nipype2pydra-version>` with the '.'s stripped, e.g.
77+
`v0.2.3post185010` corresponds to the v0.2.3 tag of this repository with auto-generated
78+
packages from Nipype 1.8.5 using Nipype2Pydra 0.1.0.
79+
5180
## Development
5281

53-
This project is managed with [Hatch][hatch]:
82+
### Methodology
83+
84+
The development of this package is expected to have two phases
85+
86+
1. Where the corresponding Nipype interfaces are considered to be the ground truth, and
87+
the Pydra tasks are generated from them
88+
2. When the Pydra tasks are considered be mature and they are edited by hand
89+
90+
Different tasks will probably mature at different times so there will probably be an
91+
intermediate phase between 1 and 2.
92+
93+
### Developer installation
94+
95+
Before the pydra task interfaces can be generated and installed, the file-format classes
96+
[fileformats](https://arcanaframework.github.io/fileformats/) packages
97+
corresponding to FSL specific file formats will need to be installed
98+
99+
```console
100+
pip install -e ./related-packages/fileformats[dev]
101+
pip install -e ./related-packages/fileformats-extras[dev]
102+
```
103+
104+
Next install the requirements for running the auto-conversion script and generate the
105+
Pydra task interfaces from their Nipype counterparts
106+
107+
```console
108+
pip install -r nipype-auto-conv/requirements.txt
109+
```
110+
111+
The run the conversion script to convert Nipype interfaces to Pydra
112+
113+
```console
114+
nipype-auto-conv/generate
115+
```
116+
117+
Install repo in developer mode from the source directory and install pre-commit to
118+
ensure consistent code-style and quality.
54119

55120
```console
56-
pipx install hatch
121+
pip install -e .[test,dev]
122+
pre-commit install
57123
```
58124

59-
To run the test suite:
125+
### Auto-conversion phase
126+
127+
The auto-converted Pydra tasks are generated from their corresponding Nipype interface
128+
in combination with "conversion hints" contained in YAML specs
129+
located in `nipype-auto-conv/specs/`. The self-documented conversion specs are
130+
to be edited by hand in order to assist the auto-converter produce valid pydra tasks.
131+
After editing one or more conversion specs the `pydra.tasks.fsl.auto` package should
132+
be regenerated by running
133+
134+
```console
135+
nipype-auto-conv/generate
136+
```
137+
138+
The tests should be run on the auto-generated tasks to see if they are valid
60139

61140
```console
62-
hatch run test
141+
pytest pydra/tasks/fsl/auto/tests/test_<the-name-of-the-task-you-edited>.py
63142
```
64143

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

67149
```console
68-
hatch run lint:fix
150+
from pydra.tasks.fsl.auto import <the-task-you-have-validated>
69151
```
70152

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

73184
This project is distributed under the terms of the [Apache License, Version 2.0][license].
@@ -95,3 +206,11 @@ This project is distributed under the terms of the [Apache License, Version 2.0]
95206
[hatch]: https://hatch.pypa.io/
96207

97208
[license]: https://spdx.org/licenses/Apache-2.0.html
209+
210+
[status-docs-badge]: https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat
211+
212+
[status-cicd-badge]: https://github.com/nipype/pydra-fsl/actions/workflows/ci-cd.yaml/badge.svg
213+
214+
[status-docs-link]: https://nipype.github.io/pydra-fsl/
215+
216+
[status-cicd-link]: https://github.com/nipype/pydra-fsl/actions/workflows/ci-cd.yaml

0 commit comments

Comments
 (0)