Skip to content

Commit ad1525e

Browse files
committed
DOC: Update docs
1 parent 10aa52b commit ad1525e

File tree

15 files changed

+307
-1428
lines changed

15 files changed

+307
-1428
lines changed

docs/Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ SPHINXOPTS =
66
SPHINXBUILD = sphinx-build
77
PAPER =
88
BUILDDIR = _build
9-
CURBRANCH = master
9+
OUTDIR = html
1010
PYTHONPATH = $(PWD)
1111

1212
# User-friendly check for sphinx-build
@@ -53,10 +53,13 @@ clean:
5353
rm -rf $(BUILDDIR)/*
5454
rm -rf reference/*
5555

56+
docs-coverage:
57+
PYTHONPATH=$(PYTHONPATH) $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
58+
5659
html:
57-
PYTHONPATH=$(PYTHONPATH) $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
60+
PYTHONPATH=$(PYTHONPATH) $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/$(OUTDIR)
5861
@echo
59-
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
62+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/$(OUTDIR)."
6063

6164
dirhtml:
6265
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@@ -179,6 +182,3 @@ pseudoxml:
179182
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
180183
@echo
181184
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
182-
183-
versioned:
184-
PYTHONPATH=$(PYTHONPATH) sphinx-versioning -vv -l ./docs/conf.py build -r $(CURBRANCH) ./docs/ docs/$(BUILDDIR)/html/

docs/_static/css/version-switch.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.version-tree ul {
2+
list-style-type: none;
3+
}

docs/_static/js/version-switch.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
$(document).ready(function() {
2+
var pathname = window.location.pathname;
3+
var cur_ver = $("#version-slug").text().replace(/^[\n\s]+|[\n\s]+$/g, '')
4+
var major_minor = "master";
5+
if ( cur_ver.lastIndexOf(" (dev)") == -1 ) {
6+
major_minor = `${cur_ver.split('.')[0]}.${cur_ver.split('.')[1]}`
7+
}
8+
var relpath = pathname.substring(pathname.lastIndexOf(major_minor)).replace(/\/$/, '');
9+
var levels = relpath.split("/").length - 1
10+
if ( levels == 0 ) {
11+
levels = 1
12+
relpath += "/"
13+
}
14+
var versions_file = "../".repeat(levels) + "versions.json"
15+
relpath = "../".repeat(levels) + relpath
16+
relpath = relpath.replace("//", "/")
17+
console.log(`relpath="${relpath}", cur_ver="${cur_ver}"`)
18+
19+
$.getJSON(versions_file, function (data) {
20+
$("#version-slug").remove(); // Unnecessary if JSON was downloaded
21+
22+
$.each(data["tags"].reverse(), function( i, val ) {
23+
var new_path = relpath.replace(major_minor, val)
24+
var item = `<li class="toctree-l2"><a class="reference internal" href="${new_path}">${val}</a></li>`
25+
if ( i == 0 ) {
26+
item = `<li class="toctree-l2"><a class="reference internal" href="${new_path}">${val} (Latest Release)</a></li>`
27+
}
28+
$("#v-tags").append(item)
29+
});
30+
$.each(data["heads"].reverse(), function( i, val ) {
31+
var new_path = relpath.replace(major_minor, val)
32+
var item = `<li class="toctree-l2"><a class="reference internal" href="${new_path}">${val}</a></li>`
33+
if ( val == "master" ) {
34+
item = `<li class="toctree-l2"><a class="reference internal" href="${new_path}">${val} (Development)</a></li>`
35+
}
36+
$("#v-tags").append(item)
37+
});
38+
}).fail(function() {
39+
$("#version-menu").hide(); // JSON download failed - hide dropdown
40+
});
41+
});

docs/_templates/sidebar/brand.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<a class="sidebar-brand{% if logo %} centered{% endif %}" href="{{ pathto(master_doc) }}">
2+
<span class="sidebar-brand-text">{{ project }}</span>
3+
<span id="version-slug" class="sidebar-brand-text">{{ version if version == release else version + ' (dev)' }}</span>
4+
</a>
5+
6+
<!-- Versions dropdown -->
7+
<div id="version-menu" class="version-tree">
8+
<ul>
9+
<li class="toctree-l1 has-children">
10+
<span class="sidebar-brand-text">{{ version if version == release else version + ' (dev)' }}</span>
11+
<input class="toctree-checkbox" id="toctree-checkbox-v" name="toctree-checkbox-v" role="switch" type="checkbox">
12+
<label for="toctree-checkbox-v"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label>
13+
<ul id="v-tags"></ul>
14+
</ul>
15+
</div>

docs/api.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Information on specific functions, classes, and methods.
66
.. toctree::
77
:glob:
88

9+
api/sdcflows.cli
910
api/sdcflows.interfaces
1011
api/sdcflows.viz
11-
api/sdcflows.workflows
12+
api/sdcflows.workflows

docs/conf.py

Lines changed: 92 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,82 @@
1-
# Configuration file for the Sphinx documentation builder.
2-
#
3-
# This file does only contain a selection of the most common options. For a
4-
# full list see the documentation:
5-
# http://www.sphinx-doc.org/en/master/config
1+
"""
2+
Configuration file for the Sphinx documentation builder.
63
7-
# -- Path setup --------------------------------------------------------------
4+
This file does only contain a selection of the most common options. For a
5+
full list see the documentation:
6+
http://www.sphinx-doc.org/en/master/config
87
9-
# If extensions (or modules to document with autodoc) are in another directory,
10-
# add these directories to sys.path here. If the directory is relative to the
11-
# documentation root, use os.path.abspath to make it absolute, like shown here.
12-
#
13-
import os
14-
import sys
8+
"""
159
from packaging.version import Version
16-
1710
from sdcflows import __version__, __copyright__, __packagename__
1811

19-
sys.path.append(os.path.abspath('sphinxext'))
12+
# -- Path setup --------------------------------------------------------------
13+
# If extensions (or modules to document with autodoc) are in another directory,
14+
# add these directories to sys.path here. If the directory is relative to the
15+
# documentation root, use os.path.abspath to make it absolute, like shown here.
16+
# sys.path.append(os.path.abspath("sphinxext"))
2017

2118
# -- Project information -----------------------------------------------------
2219
project = __packagename__
2320
copyright = __copyright__
24-
author = 'The SDCflows Developers'
21+
author = "The SDCflows Developers"
2522

2623
# The short X.Y version
2724
version = Version(__version__).public
2825
# The full version, including alpha/beta/rc tags
29-
release = version
30-
26+
release = __version__
3127

3228
# -- General configuration ---------------------------------------------------
3329
extensions = [
34-
'sphinx.ext.autodoc',
35-
'sphinx.ext.doctest',
36-
'sphinx.ext.intersphinx',
37-
'sphinx.ext.coverage',
38-
'sphinx.ext.mathjax',
39-
'sphinx.ext.ifconfig',
40-
'sphinx.ext.viewcode',
41-
'sphinx.ext.githubpages',
42-
'nipype.sphinxext.plot_workflow',
43-
'sphinxcontrib.apidoc',
44-
'sphinxcontrib.napoleon'
30+
"sphinx.ext.autodoc",
31+
"sphinx.ext.coverage",
32+
"sphinx.ext.doctest",
33+
"sphinx.ext.githubpages",
34+
"sphinx.ext.ifconfig",
35+
"sphinx.ext.intersphinx",
36+
"sphinx.ext.mathjax",
37+
"sphinx.ext.viewcode",
38+
"sphinxcontrib.apidoc",
39+
"nipype.sphinxext.apidoc",
40+
"nipype.sphinxext.plot_workflow",
4541
]
4642

4743
autodoc_mock_imports = [
48-
'matplotlib',
49-
'nilearn',
50-
'nipy',
51-
'nitime',
52-
'numpy',
53-
'pandas',
54-
'seaborn',
55-
'skimage',
56-
'svgutils',
57-
'transforms3d',
44+
"matplotlib",
45+
"nilearn",
46+
"nipy",
47+
"nitime",
48+
"numpy",
49+
"pandas",
50+
"seaborn",
51+
"skimage",
52+
"svgutils",
53+
"transforms3d",
5854
]
5955

6056
# Accept custom section names to be parsed for numpy-style docstrings
6157
# of parameters.
62-
# Requires pinning sphinxcontrib-napoleon to a specific commit while
63-
# https://github.com/sphinx-contrib/napoleon/pull/10 is merged.
6458
napoleon_use_param = False
6559
napoleon_custom_sections = [
66-
('Inputs', 'Parameters'),
67-
('Outputs', 'Parameters'),
60+
("Inputs", "Parameters"),
61+
("Outputs", "Parameters"),
62+
("Attributes", "Parameters"),
63+
("Mandatory Inputs", "Parameters"),
64+
("Optional Inputs", "Parameters"),
6865
]
6966

7067
# Add any paths that contain templates here, relative to this directory.
71-
templates_path = ['_templates']
68+
templates_path = ["_templates"]
7269

7370
# The suffix(es) of source filenames.
7471
# You can specify multiple suffix as a list of string:
7572
#
7673
# source_suffix = ['.rst', '.md']
77-
source_suffix = '.rst'
74+
source_suffix = ".rst"
7875

7976
# The master toctree document.
80-
master_doc = 'index'
77+
master_doc = "index"
78+
79+
numfig = True
8180

8281
# The language for content autogenerated by Sphinx. Refer to documentation
8382
# for a list of supported languages.
@@ -90,9 +89,11 @@
9089
# directories to ignore when looking for source files.
9190
# This pattern also affects html_static_path and html_extra_path.
9291
exclude_patterns = [
93-
'_build', 'Thumbs.db', '.DS_Store',
94-
'api/sdcflows.rst',
95-
'api/sdcflows.cli.rst', 'api/sdcflows.cli.*.rst']
92+
"_build",
93+
"Thumbs.db",
94+
".DS_Store",
95+
"api/sdcflows.rst",
96+
]
9697

9798
# The name of the Pygments (syntax highlighting) style to use.
9899
pygments_style = None
@@ -103,7 +104,7 @@
103104
# The theme to use for HTML and HTML Help pages. See the documentation for
104105
# a list of builtin themes.
105106
#
106-
html_theme = 'sphinx_rtd_theme'
107+
html_theme = "furo"
107108

108109
# Theme options are theme-specific and customize the look and feel of a theme
109110
# further. For a list of options available for each theme, see the
@@ -114,7 +115,13 @@
114115
# Add any paths that contain custom static files (such as style sheets) here,
115116
# relative to this directory. They are copied after the builtin static files,
116117
# so a file named "default.css" will overwrite the builtin "default.css".
117-
html_static_path = ['_static']
118+
html_static_path = ["_static"]
119+
html_js_files = [
120+
"js/version-switch.js",
121+
]
122+
html_css_files = [
123+
"css/version-switch.css",
124+
]
118125

119126
# Custom sidebar templates, must be a dictionary that maps document names
120127
# to template names.
@@ -130,7 +137,7 @@
130137
# -- Options for HTMLHelp output ---------------------------------------------
131138

132139
# Output file base name for HTML help builder.
133-
htmlhelp_basename = 'sdcflowsdoc'
140+
htmlhelp_basename = "sdcflowsdoc"
134141

135142

136143
# -- Options for LaTeX output ------------------------------------------------
@@ -139,15 +146,12 @@
139146
# The paper size ('letterpaper' or 'a4paper').
140147
#
141148
# 'papersize': 'letterpaper',
142-
143149
# The font size ('10pt', '11pt' or '12pt').
144150
#
145151
# 'pointsize': '10pt',
146-
147152
# Additional stuff for the LaTeX preamble.
148153
#
149154
# 'preamble': '',
150-
151155
# Latex figure (float) alignment
152156
#
153157
# 'figure_align': 'htbp',
@@ -157,19 +161,21 @@
157161
# (source start file, target name, title,
158162
# author, documentclass [howto, manual, or own class]).
159163
latex_documents = [
160-
(master_doc, 'smriprep.tex', 'sMRIPrep Documentation',
161-
'The sMRIPrep Developers', 'manual'),
164+
(
165+
master_doc,
166+
"smriprep.tex",
167+
"sMRIPrep Documentation",
168+
"The sMRIPrep Developers",
169+
"manual",
170+
),
162171
]
163172

164173

165174
# -- Options for manual page output ------------------------------------------
166175

167176
# One entry per manual page. List of tuples
168177
# (source start file, name, description, authors, manual section).
169-
man_pages = [
170-
(master_doc, 'smriprep', 'sMRIPrep Documentation',
171-
[author], 1)
172-
]
178+
man_pages = [(master_doc, "smriprep", "sMRIPrep Documentation", [author], 1)]
173179

174180

175181
# -- Options for Texinfo output ----------------------------------------------
@@ -178,9 +184,15 @@
178184
# (source start file, target name, title, author,
179185
# dir menu entry, description, category)
180186
texinfo_documents = [
181-
(master_doc, 'smriprep', 'sMRIPrep Documentation',
182-
author, 'sMRIPrep', 'One line description of project.',
183-
'Miscellaneous'),
187+
(
188+
master_doc,
189+
"smriprep",
190+
"sMRIPrep Documentation",
191+
author,
192+
"sMRIPrep",
193+
"One line description of project.",
194+
"Miscellaneous",
195+
),
184196
]
185197

186198

@@ -199,21 +211,32 @@
199211
# epub_uid = ''
200212

201213
# A list of files that should not be packed into the epub file.
202-
epub_exclude_files = ['search.html']
214+
epub_exclude_files = ["search.html"]
203215

204216

205217
# -- Extension configuration -------------------------------------------------
206218

207-
apidoc_module_dir = '../sdcflows'
208-
apidoc_output_dir = 'api'
209-
apidoc_excluded_paths = ['conftest.py', '*/tests/*', 'tests/*', 'data/*']
219+
apidoc_module_dir = "../sdcflows"
220+
apidoc_output_dir = "api"
221+
apidoc_excluded_paths = ["conftest.py", "*/tests/*", "tests/*", "data/*"]
210222
apidoc_separate_modules = True
211-
apidoc_extra_args = ['--module-first', '-d 1', '-T']
223+
apidoc_extra_args = ["--module-first", "-d 1", "-T"]
212224

213225
# -- Options for intersphinx extension ---------------------------------------
214226

215227
# Example configuration for intersphinx: refer to the Python standard library.
216-
intersphinx_mapping = {'https://docs.python.org/': None}
228+
intersphinx_mapping = {
229+
"python": ("https://docs.python.org/3/", None),
230+
"numpy": ("https://numpy.org/doc/stable/", None),
231+
"scipy": ("https://docs.scipy.org/doc/scipy/", None),
232+
"matplotlib": ("https://matplotlib.org/stable", None),
233+
"bids": ("https://bids-standard.github.io/pybids/", None),
234+
"nibabel": ("https://nipy.org/nibabel/", None),
235+
"nipype": ("https://nipype.readthedocs.io/en/latest/", None),
236+
"niworkflows": ("https://www.nipreps.org/niworkflows/", None),
237+
"smriprep": ("https://www.nipreps.org/smriprep/", None),
238+
"templateflow": ("https://www.templateflow.org/python-client", None),
239+
}
217240

218241
# -- Options for versioning extension ----------------------------------------
219242
scv_show_banner = True

0 commit comments

Comments
 (0)