Skip to content

Commit cb1e376

Browse files
committed
DOC: Documentation overhaul
Building on top of #3119 and #3129, this PR makes a deep revision of the documentation: * Added a new ``build_docs`` job to CircleCI to test how it renders. * Minimized external machinery (under ``/tools/``) when building the documentation: 1. Some minimal modifications to sphinx extensions (apidoc, napoleon) allow the generation of special documentation for nipype interfaces, as it used to be before this PR 2. A new sphinx extension (``nipype.sphinxext.apidoc``) takes care of parsing and rendering inputs and outputs. They now look like the parameters/arguments of functions when formatted with numpydoc. * Revised the description of many interfaces and the documentation of the main class and the input/output specs. * Revised the structure of the navbar, separating out User-Guide/Examples, Interfaces-Index, and Devs' documentation. * Minimized the number of WARNINGS at documentation build to 5 (4 of them coming out from the auto-generated SEM tools).
1 parent 9248d8f commit cb1e376

File tree

113 files changed

+3126
-3654
lines changed

Some content is hidden

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

113 files changed

+3126
-3654
lines changed

.circleci/config.yml

+47
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,35 @@ jobs:
394394
ssh-add ~/.ssh/id_ed25519
395395
/home/circleci/nipype/tools/feedstock.sh
396396
397+
build_docs:
398+
docker:
399+
- image: python:3.7.4
400+
working_directory: /tmp/src/nipype
401+
environment:
402+
- FSLOUTPUTTYPE: 'NIFTI'
403+
steps:
404+
- checkout
405+
name: Check Python version and upgrade pip
406+
command: |
407+
python --version
408+
python -m pip install -U pip
409+
- run:
410+
name: Install graphviz
411+
command: |
412+
apt-get update
413+
apt-get install -y graphviz
414+
- run:
415+
name: Install Requirements (may contain pinned versions)
416+
command: python -m pip install -r docs/requirements.txt
417+
- run:
418+
name: Install NiPype
419+
command: python -m pip install ".[doc]"
420+
- run:
421+
name: Build documentation
422+
command: make -C doc html
423+
- store_artifacts:
424+
path: /tmp/src/nipype/doc/_build/html
425+
397426
workflows:
398427
version: 2
399428
build_test_deploy:
@@ -406,21 +435,39 @@ workflows:
406435
only: /.*/
407436
- compare_base_dockerfiles:
408437
filters:
438+
branches:
439+
ignore:
440+
- /docs?\/.*/
409441
tags:
410442
only: /.*/
411443
- test_pytest:
412444
filters:
445+
branches:
446+
ignore:
447+
- /docs?\/.*/
413448
tags:
414449
only: /.*/
415450
requires:
416451
- compare_base_dockerfiles
417452
- test_fmri_fsl_spm:
453+
filters:
454+
branches:
455+
ignore:
456+
- /docs?\/.*/
418457
requires:
419458
- compare_base_dockerfiles
420459
- test_fmri_spm_dartel_multiproc:
460+
filters:
461+
branches:
462+
ignore:
463+
- /docs?\/.*/
421464
requires:
422465
- compare_base_dockerfiles
423466
- test_fmri_spm_nested_fsl_feeds:
467+
filters:
468+
branches:
469+
ignore:
470+
- /docs?\/.*/
424471
requires:
425472
- compare_base_dockerfiles
426473
- deploy_dockerhub:

doc/Makefile

+5-26
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ PAPEROPT_a4 = -D latex_paper_size=a4
1111
PAPEROPT_letter = -D latex_paper_size=letter
1212
ALLSPHINXOPTS = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
1313

14-
.PHONY: help clean html nipypeapi htmlonly latex changes linkcheck doctest
14+
.PHONY: help clean html htmlonly latex changes linkcheck doctest
1515

1616
help:
1717
@echo "Please use \`make <target>' where <target> is one of"
1818
@echo " html make the HTML documentation"
19-
@echo " nipypeapi make interface API documents only"
2019
@echo " latex make the LaTeX, you can set PAPER=a4 or PAPER=letter"
2120
@echo " pdf make <latex> and run the PDF generation"
2221
@echo " changes make an overview of all changed/added/deprecated" \
@@ -33,20 +32,15 @@ htmlonly:
3332
@echo
3433
@echo "Build finished. The HTML pages are in _build/html."
3534

36-
nipypeapi:
37-
rm -rf interfaces/generated
38-
python -u ../tools/build_interface_docs.py
39-
@echo "Build API docs finished."
40-
41-
html: clean examples2rst nipypeapi htmlonly
35+
html: clean examples2rst htmlonly
4236
@echo "Build HTML and API finished."
4337

44-
examples2rst:
38+
examples2rst: clean
4539
mkdir -p users/examples
46-
../tools/make_examples.py --no-exec
40+
../tools/make_examples.py -x ../../../examples/test_spm.py --no-exec
4741
@echo "examples2rst finished."
4842

49-
latex: nipypeapi
43+
latex: clean
5044
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex
5145
@echo
5246
@echo "Build finished; the LaTeX files are in _build/latex."
@@ -80,18 +74,3 @@ gitwash-update:
8074
--project-url=http://nipy.org/nipype \
8175
--project-ml-url=http://mail.scipy.org/mailman/listinfo/nipy-devel
8276
@echo "gitwash updated"
83-
84-
# Sourceforge doesn't appear to have a way of copying the files
85-
# without specifying a username. So we'll probably have one target
86-
# for each project admin
87-
sf_satra_nightly: html
88-
@echo "Copying html files to sourceforge..."
89-
scp -r _build/html/* satra,nipy@web.sourceforge.net:htdocs/nipype-nightly/
90-
91-
sf_satra: html
92-
@echo "Copying html files to sourceforge..."
93-
rsync -auv _build/html/. satra,nipy@web.sourceforge.net:htdocs/nipype/.
94-
95-
sf_filo: html
96-
@echo "Copying html files to sourceforge..."
97-
rsync -auv _build/html/. gorgolewski,nipy@web.sourceforge.net:htdocs/nipype/.

doc/README.txt

-28
This file was deleted.

doc/_templates/navbar.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99

1010
<a class="navbar" href="{{pathto('index')}}">Home</a> ·
1111
<a class="navbar" href="{{pathto('quickstart')}}">Quickstart</a> ·
12-
<a class="navbar" href="{{pathto('documentation')}}">Documentation</a> ·
12+
<a class="navbar" href="{{pathto('examples')}}">User Guide and Examples</a> ·
13+
<a class="navbar" href="{{pathto('interfaces')}}">Interfaces Index</a> ·
14+
<a class="navbar" href="{{pathto('developers')}}">Developers</a> ·
1315
<a class="navbar" href="{{pathto('about')}}">About</a> ·
1416
<a class="navbar" href="http://nipy.org">Nipy</a>
1517

doc/about.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
:orphan:
2+
13
.. _about:
24

35
=====

doc/api/index.rst

-15
This file was deleted.

doc/changes.rst

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
:orphan:
12
:tocdepth: 2
23

34
.. _changes:

doc/conf.py

+7-13
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@
1616
from packaging.version import Version
1717
import nipype
1818

19-
# if not os.path.exists('users/examples'):
20-
# os.mkdir('users/examples')
21-
# os.system('python ../tools/make_examples.py --no-exec')
22-
23-
# if os.path.exists('interfaces/generated'):
24-
# rmtree('interfaces/generated')
25-
# os.system('python ../tools/build_interface_docs.py')
26-
2719
# If extensions (or modules to document with autodoc) are in another directory,
2820
# add these directories to sys.path here. If the directory is relative to the
2921
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -41,9 +33,11 @@
4133
'sphinx.ext.inheritance_diagram',
4234
'sphinx.ext.todo',
4335
'sphinxcontrib.apidoc',
44-
'sphinxcontrib.napoleon',
4536
'matplotlib.sphinxext.plot_directive',
37+
'nbsphinx',
4638
'nipype.sphinxext.plot_workflow',
39+
'nipype.sphinxext.apidoc',
40+
'nipype.sphinxext.documenter',
4741
]
4842

4943
autodoc_mock_imports = [
@@ -57,6 +51,8 @@
5751
'skimage',
5852
'svgutils',
5953
'transforms3d',
54+
'tvtk',
55+
'vtk'
6056
]
6157

6258
# Accept custom section names to be parsed for numpy-style docstrings
@@ -68,6 +64,8 @@
6864
('Inputs', 'Parameters'),
6965
('Outputs', 'Parameters'),
7066
('Attributes', 'Parameters'),
67+
('Mandatory Inputs', 'Parameters'),
68+
('Optional Inputs', 'Parameters'),
7169
]
7270

7371

@@ -122,8 +120,6 @@
122120
# This pattern also affects html_static_path and html_extra_path.
123121
exclude_patterns = [
124122
'_build', 'Thumbs.db', '.DS_Store',
125-
'api/generated/gen.rst',
126-
'interfaces/generated/gen.rst'
127123
]
128124

129125
# The reST default role (used for this markup: `text`) to use for all documents.
@@ -278,10 +274,8 @@
278274
apidoc_output_dir = 'api/generated'
279275
apidoc_excluded_paths = [
280276
'*/tests/*', 'tests/*',
281-
'algorithms/*',
282277
'external/*',
283278
'fixes/*',
284-
'interfaces/*',
285279
'scripts/*',
286280
'sphinxext/*',
287281
'testing/*',

doc/developers.rst

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
:orphan:
2+
3+
.. _developers:
4+
5+
==================
6+
Developer's Corner
7+
==================
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
12+
devel/index
13+
14+
.. toctree::
15+
:maxdepth: 3
16+
17+
api/generated/nipype

doc/documentation.rst

-73
This file was deleted.

doc/examples.rst

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
:orphan:
2+
3+
.. _examples:
4+
5+
=======================
6+
User Guide and Examples
7+
=======================
8+
9+
.. admonition:: Michael Notter's User Guide
10+
11+
Be sure to read `Michael's excellent tutorials <https://miykael.github.io/nipype_tutorial/>`__.
12+
13+
Examples
14+
~~~~~~~~
15+
.. toctree::
16+
:maxdepth: 1
17+
:glob:
18+
19+
users/examples/*

0 commit comments

Comments
 (0)