|
6 | 6 |
|
7 | 7 | import os
|
8 | 8 | import sys
|
9 |
| -from datetime import datetime |
10 |
| -from sphinx import __version__ as sphinxversion |
| 9 | +from datetime import datetime, timezone |
| 10 | + |
11 | 11 | from packaging.version import Version, parse
|
| 12 | +from sphinx import __version__ as sphinxversion |
| 13 | + |
| 14 | +import nibabies |
12 | 15 |
|
13 | 16 | # -- Path setup --------------------------------------------------------------
|
14 | 17 | here = os.path.dirname(__file__)
|
15 | 18 | # If extensions (or modules to document with autodoc) are in another directory,
|
16 | 19 | # add these directories to sys.path here. If the directory is relative to the
|
17 | 20 | # documentation root, use os.path.abspath to make it absolute, like shown here.
|
18 |
| -sys.path.append(os.path.join(here, "sphinxext")) |
19 |
| -sys.path.insert(0, os.path.join(here, "..", "wrapper")) |
| 21 | +sys.path.append(os.path.join(here, 'sphinxext')) |
| 22 | +sys.path.insert(0, os.path.join(here, '..', 'wrapper')) |
20 | 23 |
|
21 |
| -from github_link import make_linkcode_resolve # this is only available after sphinxext to PATH |
| 24 | +# this is only available after sphinxext to PATH |
| 25 | +from github_link import make_linkcode_resolve # noqa: E402 |
22 | 26 |
|
23 | 27 | # -- General configuration ---------------------------------------------------
|
24 | 28 |
|
25 | 29 | # If your documentation needs a minimal Sphinx version, state it here.
|
26 |
| -needs_sphinx = "1.5.3" |
| 30 | +needs_sphinx = '1.5.3' |
27 | 31 |
|
28 | 32 | # Add any Sphinx extension module names here, as strings. They can be
|
29 | 33 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
30 | 34 | # ones.
|
31 | 35 | extensions = [
|
32 |
| - "sphinx.ext.autodoc", |
33 |
| - "sphinx.ext.doctest", |
34 |
| - "sphinx.ext.intersphinx", |
35 |
| - "sphinx.ext.coverage", |
36 |
| - "sphinx.ext.mathjax", |
37 |
| - "sphinx.ext.linkcode", |
38 |
| - "sphinx.ext.napoleon", |
39 |
| - "sphinxarg.ext", # argparse extension |
40 |
| - "nipype.sphinxext.plot_workflow", |
41 |
| - "myst_nb", # stop segregating rst/md |
| 36 | + 'sphinx.ext.autodoc', |
| 37 | + 'sphinx.ext.doctest', |
| 38 | + 'sphinx.ext.intersphinx', |
| 39 | + 'sphinx.ext.coverage', |
| 40 | + 'sphinx.ext.mathjax', |
| 41 | + 'sphinx.ext.linkcode', |
| 42 | + 'sphinx.ext.napoleon', |
| 43 | + 'sphinxcontrib.bibtex', |
| 44 | + 'sphinxarg.ext', # argparse extension |
| 45 | + 'nipype.sphinxext.plot_workflow', |
| 46 | + 'myst_parser', # allow markdown |
| 47 | + # 'sphinx-togglebutton', # collapse admonitions |
42 | 48 | ]
|
43 | 49 |
|
44 |
| -autodoc_mock_imports = [ |
45 |
| - "numpy", |
46 |
| - "nibabel", |
47 |
| - "nilearn" |
48 |
| -] |
49 |
| -if parse(sphinxversion) >= parse("1.7.0"): |
50 |
| - autodoc_mock_imports += [ |
51 |
| - "pandas", |
52 |
| - "nilearn", |
53 |
| - "seaborn", |
| 50 | +bibtex_bibfiles = ['../nibabies/data/boilerplate.bib'] |
| 51 | + |
| 52 | +autodoc_mock_imports = ['numpy', 'nibabel', 'nilearn'] |
| 53 | +if parse(sphinxversion) >= parse('1.7.0'): |
| 54 | + autodoc_mock_imports = [ |
| 55 | + 'pandas', |
| 56 | + 'nilearn', |
| 57 | + 'seaborn', |
54 | 58 | ]
|
55 | 59 |
|
56 | 60 | # Add any paths that contain templates here, relative to this directory.
|
|
62 | 66 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
63 | 67 |
|
64 | 68 |
|
65 |
| -source_suffix = [".rst", ".md"] |
| 69 | +source_suffix = ['.rst', '.md'] |
66 | 70 |
|
67 | 71 | # -- Options for HTML output -------------------------------------------------
|
68 | 72 |
|
69 | 73 | # The theme to use for HTML and HTML Help pages. See the documentation for
|
70 | 74 | # a list of builtin themes.
|
71 | 75 | #
|
72 |
| -html_theme = 'sphinx_rtd_theme' |
| 76 | +html_theme = 'shibuya' |
| 77 | + |
| 78 | +# Options specific to theme |
| 79 | +html_theme_options = { |
| 80 | + 'color_mode': 'light', |
| 81 | + 'dark_code': True, |
| 82 | + 'github_url': 'https://github.com/nipreps/nibabies', |
| 83 | + 'nav_links': [ |
| 84 | + { |
| 85 | + 'title': 'NiPreps Homepage', |
| 86 | + 'url': 'https://nipreps.org', |
| 87 | + 'external': True, |
| 88 | + }, |
| 89 | + { |
| 90 | + 'title': 'Docker Hub', |
| 91 | + 'url': 'https://hub.docker.com/r/nipreps/nibabies', |
| 92 | + 'external': True, |
| 93 | + }, |
| 94 | + ], |
| 95 | +} |
73 | 96 |
|
74 | 97 | # Add any paths that contain custom static files (such as style sheets) here,
|
75 | 98 | # relative to this directory. They are copied after the builtin static files,
|
|
83 | 106 | # https://github.com/sphinx-contrib/napoleon/pull/10 is merged.
|
84 | 107 | napoleon_use_param = False
|
85 | 108 | napoleon_custom_sections = [
|
86 |
| - ("Inputs", "Parameters"), |
87 |
| - ("Outputs", "Parameters"), |
| 109 | + ('Inputs', 'Parameters'), |
| 110 | + ('Outputs', 'Parameters'), |
88 | 111 | ]
|
89 | 112 |
|
90 | 113 | # -- MyST parameters ---------------------------------------------------------
|
91 | 114 |
|
92 | 115 | myst_heading_anchors = 3
|
93 | 116 | myst_enable_extensions = [
|
94 |
| - "colon_fence", |
95 |
| - "substitution", |
| 117 | + 'colon_fence', |
| 118 | + 'substitution', |
96 | 119 | ]
|
97 | 120 |
|
98 |
| -linkcode_resolve = make_linkcode_resolve("nibabies", |
99 |
| - "https://github.com/nipreps/" |
100 |
| - "nibabies/blob/{revision}/" |
101 |
| - "{package}/{path}#L{lineno}") |
| 121 | +linkcode_resolve = make_linkcode_resolve( |
| 122 | + 'nibabies', |
| 123 | + 'https://github.com/nipreps/' 'nibabies/blob/{revision}/' '{package}/{path}#L{lineno}', |
| 124 | +) |
102 | 125 |
|
103 |
| -project = "NiBabies" |
104 |
| -author = "The NiPreps developers" |
105 |
| -copyright = "2021-%s, %s" % (datetime.now().year, author) |
| 126 | +project = 'NiBabies' |
| 127 | +author = 'The NiPreps developers' |
106 | 128 |
|
107 |
| -import nibabies |
| 129 | +copyright = f'2021-{datetime.now(tz=timezone.utc)}, {author}' |
108 | 130 |
|
109 | 131 | nibabies_ver = Version(nibabies.__version__)
|
110 |
| -release = "version" if nibabies_ver.is_prerelease else nibabies_ver.public |
111 |
| - |
112 |
| -myst_substitutions = { |
113 |
| - "release": release, |
114 |
| - "version": str(nibabies_ver), |
115 |
| - "dockerbuild": "docker pull nipreps/nibabies:{{ release }}", |
116 |
| - "singbuild": ( |
117 |
| - "singularity build nibabies-{{ release }}.sif docker://nipreps/nibabies:{{ release }}" |
118 |
| - ), |
119 |
| -} |
| 132 | +release = 'version' if nibabies_ver.is_prerelease else nibabies_ver.public |
120 | 133 |
|
121 | 134 | # to avoid Python highlighting in literal text
|
122 |
| -highlight_language = "none" |
| 135 | +highlight_language = 'none' |
0 commit comments