Skip to content

Commit 1386dec

Browse files
authored
Merge pull request #14 from nipype/add-docs
add docs to ci/cd and readme
2 parents 672d5c2 + d17e2d4 commit 1386dec

File tree

7 files changed

+265
-25
lines changed

7 files changed

+265
-25
lines changed

.github/workflows/ci-cd.yaml

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ env:
2121
FREESURFER_HOME: /opt/freesurfer
2222
DOWNLOADS_DIR: /downloads/freesurfer
2323

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

2631
nipype-conv:
@@ -36,6 +41,8 @@ jobs:
3641

3742
- name: Set up Python
3843
uses: actions/setup-python@v5
44+
with:
45+
python-version: '3.x'
3946

4047
- name: Install build dependencies
4148
run: python -m pip install --upgrade pip
@@ -131,19 +138,20 @@ jobs:
131138
sudo mkdir -p $FREESURFER_HOME
132139
sudo chown $USER $FREESURFER_HOME
133140
134-
- name: Cache Freesurfer Install
135-
id: cache-install
136-
uses: actions/cache@v4
137-
with:
138-
path: ${{ env.DOWNLOADS_DIR }}
139-
key: freesurfer-${{ env.FREESURFER_VERSION }}-${{ runner.os }}
141+
# - name: Cache Freesurfer Download
142+
# id: cache-install
143+
# uses: actions/cache@v4
144+
# with:
145+
# path: ${{ env.DOWNLOADS_DIR }}
146+
# key: freesurfer-${{ env.FREESURFER_VERSION }}-${{ runner.os }}
140147

141148
- name: Download FreeSurfer
142-
if: steps.cache-install.outputs.cache-hit != 'true'
149+
# if: steps.cache-install.outputs.cache-hit != 'true'
143150
run: |
144151
sudo mkdir -p $DOWNLOADS_DIR
145152
sudo chown $USER $DOWNLOADS_DIR
146-
curl -s -o $DOWNLOADS_DIR/freesurfer-linux-ubuntu22_amd64-${{ env.FREESURFER_VERSION }}.tar.gz https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/${{ env.FREESURFER_VERSION }}/freesurfer-linux-ubuntu22_amd64-${{ env.FREESURFER_VERSION }}.tar.gz
153+
curl -s -o $DOWNLOADS_DIR/freesurfer-linux-ubuntu22_amd64-${{ env.FREESURFER_VERSION }}.tar.gz \
154+
https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/${{ env.FREESURFER_VERSION }}/freesurfer-linux-ubuntu22_amd64-${{ env.FREESURFER_VERSION }}.tar.gz
147155
shell: bash
148156

149157
- name: Install Freesurfer
@@ -394,6 +402,47 @@ jobs:
394402
draft: false
395403
prerelease: false
396404

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

README.md

Lines changed: 10 additions & 6 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-cicd]
6+
[![Status-docs][status-docs-badge]][status-docs-link]
7+
[![Status-CICD][status-cicd-badge]][status-cicd-link]
88

99
----
1010

@@ -136,10 +136,10 @@ ready for use, where v* corresponds to the version of Freesurfer that you have t
136136
it against e.g.
137137

138138
```console
139-
from pydra.tasks.freesurfer.auto import <the-task-you-have-validated>
139+
from pydra.tasks.freesurfer.auto import <the-task-you-have-validated>
140140
```
141141

142-
and copy the test file `pydra/tasks/freesurfer/auto/tests/test_<validated-task>.py
142+
and copy the test file `pydra/tasks/freesurfer/auto/tests/test_<validated-task>.py`
143143
into `pydra/tasks/freesurfer/v*/tests`.
144144

145145

@@ -189,6 +189,10 @@ This project is distributed under the terms of the [Apache License, Version 2.0]
189189

190190
[pypi-version]: https://img.shields.io/pypi/v/pydra-freesurfer.svg
191191

192-
[status-docs]: https://github.com/nipype/pydra-freesurfer/actions/workflows/docs.yaml/badge.svg
192+
[status-docs-badge]: https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat
193193

194-
[status-cicd]: https://github.com/nipype/pydra-freesurfer/actions/workflows/ci-cd.yaml/badge.svg
194+
[status-cicd-badge]: https://github.com/nipype/pydra-freesurfer/actions/workflows/ci-cd.yaml/badge.svg
195+
196+
[status-docs-link]: https://nipype.github.io/pydra-freesurfer/
197+
198+
[status-cicd-link]: https://github.com/nipype/pydra-freesurfer/actions/workflows/ci-cd.yaml

docs/Makefile

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
# Makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
PAPER =
8+
BUILDDIR = build
9+
10+
# User-friendly check for sphinx-build
11+
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
12+
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
13+
endif
14+
15+
# Internal variables.
16+
PAPEROPT_a4 = -D latex_paper_size=a4
17+
PAPEROPT_letter = -D latex_paper_size=letter
18+
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
19+
# the i18n builder cannot share the environment and doctrees with the others
20+
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
21+
22+
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
23+
24+
help:
25+
@echo "Please use \`make <target>' where <target> is one of"
26+
@echo " html to make standalone HTML files"
27+
@echo " dirhtml to make HTML files named index.html in directories"
28+
@echo " singlehtml to make a single large HTML file"
29+
@echo " pickle to make pickle files"
30+
@echo " json to make JSON files"
31+
@echo " htmlhelp to make HTML files and a HTML help project"
32+
@echo " qthelp to make HTML files and a qthelp project"
33+
@echo " applehelp to make an Apple Help Book"
34+
@echo " devhelp to make HTML files and a Devhelp project"
35+
@echo " epub to make an epub"
36+
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
37+
@echo " latexpdf to make LaTeX files and run them through pdflatex"
38+
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
39+
@echo " text to make text files"
40+
@echo " man to make manual pages"
41+
@echo " texinfo to make Texinfo files"
42+
@echo " info to make Texinfo files and run them through makeinfo"
43+
@echo " gettext to make PO message catalogs"
44+
@echo " changes to make an overview of all changed/added/deprecated items"
45+
@echo " xml to make Docutils-native XML files"
46+
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
47+
@echo " linkcheck to check all external links for integrity"
48+
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
49+
@echo " coverage to run coverage check of the documentation (if enabled)"
50+
51+
clean:
52+
rm -rf $(BUILDDIR)/*
53+
54+
html:
55+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
56+
@echo
57+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
58+
59+
dirhtml:
60+
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
61+
@echo
62+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
63+
64+
singlehtml:
65+
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
66+
@echo
67+
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
68+
69+
pickle:
70+
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
71+
@echo
72+
@echo "Build finished; now you can process the pickle files."
73+
74+
json:
75+
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
76+
@echo
77+
@echo "Build finished; now you can process the JSON files."
78+
79+
htmlhelp:
80+
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
81+
@echo
82+
@echo "Build finished; now you can run HTML Help Workshop with the" \
83+
".hhp project file in $(BUILDDIR)/htmlhelp."
84+
85+
qthelp:
86+
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
87+
@echo
88+
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
89+
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
90+
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Pype9.qhcp"
91+
@echo "To view the help file:"
92+
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Pype9.qhc"
93+
94+
applehelp:
95+
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
96+
@echo
97+
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
98+
@echo "N.B. You won't be able to view it unless you put it in" \
99+
"~/Library/Documentation/Help or install it in your application" \
100+
"bundle."
101+
102+
devhelp:
103+
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
104+
@echo
105+
@echo "Build finished."
106+
@echo "To view the help file:"
107+
@echo "# mkdir -p $$HOME/.local/share/devhelp/Pype9"
108+
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Pype9"
109+
@echo "# devhelp"
110+
111+
epub:
112+
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
113+
@echo
114+
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
115+
116+
latex:
117+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
118+
@echo
119+
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
120+
@echo "Run \`make' in that directory to run these through (pdf)latex" \
121+
"(use \`make latexpdf' here to do that automatically)."
122+
123+
latexpdf:
124+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
125+
@echo "Running LaTeX files through pdflatex..."
126+
$(MAKE) -C $(BUILDDIR)/latex all-pdf
127+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
128+
129+
latexpdfja:
130+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
131+
@echo "Running LaTeX files through platex and dvipdfmx..."
132+
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
133+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
134+
135+
text:
136+
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
137+
@echo
138+
@echo "Build finished. The text files are in $(BUILDDIR)/text."
139+
140+
man:
141+
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
142+
@echo
143+
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
144+
145+
texinfo:
146+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
147+
@echo
148+
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
149+
@echo "Run \`make' in that directory to run these through makeinfo" \
150+
"(use \`make info' here to do that automatically)."
151+
152+
info:
153+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
154+
@echo "Running Texinfo files through makeinfo..."
155+
make -C $(BUILDDIR)/texinfo info
156+
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
157+
158+
gettext:
159+
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
160+
@echo
161+
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
162+
163+
changes:
164+
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
165+
@echo
166+
@echo "The overview file is in $(BUILDDIR)/changes."
167+
168+
linkcheck:
169+
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
170+
@echo
171+
@echo "Link check complete; look for any errors in the above output " \
172+
"or in $(BUILDDIR)/linkcheck/output.txt."
173+
174+
doctest:
175+
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
176+
@echo "Testing of doctests in the sources finished, look at the " \
177+
"results in $(BUILDDIR)/doctest/output.txt."
178+
179+
coverage:
180+
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
181+
@echo "Testing of coverage in the sources finished, look at the " \
182+
"results in $(BUILDDIR)/coverage/python.txt."
183+
184+
xml:
185+
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
186+
@echo
187+
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
188+
189+
pseudoxml:
190+
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
191+
@echo
192+
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
File renamed without changes.

docs/conf.py renamed to docs/source/conf.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,15 @@
33
# For the full list of built-in configuration values, see the documentation:
44
# https://www.sphinx-doc.org/en/master/usage/configuration.html
55

6-
import sys
7-
from pathlib import Path
8-
9-
from sphinx_pyproject import SphinxConfig
10-
11-
config = SphinxConfig(globalns=globals())
12-
sys.path.insert(0, str(Path.cwd().parent / "src"))
6+
from pydra.tasks.freesurfer import __version__ # noqa
137

148
# -- Project information -----------------------------------------------------
159
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
1610

17-
project = config.name
18-
author = "The Aramis Lab"
11+
project = "pydra-freesurfer"
12+
author = "Pydra Developers"
1913
copyright = f"2022-2023, {author}"
20-
release = config.version
14+
release = __version__
2115

2216
# -- General configuration ---------------------------------------------------
2317
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
File renamed without changes.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
55
[project]
66
name = "pydra-freesurfer"
77
description = "Pydra tasks package for freesurfer"
8-
readme = "README.rst"
8+
readme = "README.md"
99
requires-python = ">=3.8"
1010
dependencies = [
1111
"pydra >=0.22",
@@ -41,6 +41,7 @@ doc = [
4141
"sphinxcontrib-apidoc ~=0.3.0",
4242
"sphinxcontrib-napoleon",
4343
"sphinxcontrib-versioning",
44+
"pydata-sphinx-theme >=0.13",
4445
]
4546
test = [
4647
"nipype2pydra",

0 commit comments

Comments
 (0)