Skip to content

Commit 5789ec0

Browse files
committed
doc fixup
1 parent 3905cd4 commit 5789ec0

File tree

1 file changed

+69
-92
lines changed

1 file changed

+69
-92
lines changed

doc/conf.py

Lines changed: 69 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@
1111
# All configuration values have a default; values that are commented out
1212
# serve to show the default.
1313

14-
import sys, os
14+
import os
15+
import sys
16+
1517
import sphinx
1618

17-
sys.path.insert(0, os.path.abspath('sphinxext'))
19+
sys.path.insert(0, os.path.abspath("sphinxext"))
1820

1921
import sphinx_gallery
22+
2023
# If extensions (or modules to document with autodoc) are in another directory,
2124
# add these directories to sys.path here. If the directory is relative to the
2225
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -26,11 +29,12 @@
2629
# This is for ReadTheDoc
2730
import matplotlib
2831
import matplotlib.sphinxext
29-
matplotlib.use('Agg')
32+
33+
matplotlib.use("Agg")
3034

3135
import pkg_resources
32-
version = pkg_resources.require(pkg_name)[0].version
3336

37+
version = pkg_resources.require(pkg_name)[0].version
3438

3539

3640
release = version
@@ -42,49 +46,46 @@
4246
import easydev
4347
from easydev import get_path_sphinx_themes
4448

45-
4649
# -- General configuration -----------------------------------------------------
4750

4851
# If your documentation needs a minimal Sphinx version, state it here.
49-
#needs_sphinx = '1.0'
52+
# needs_sphinx = '1.0'
5053

5154
# Add any Sphinx extension module names here, as strings. They can be extensions
5255
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
5356

5457
extensions = [
55-
'sphinx.ext.autodoc',
56-
('sphinx.ext.imgmath' # only available for sphinx >= 1.4
57-
if sphinx.version_info[:2] >= (1, 4)
58-
else 'sphinx.ext.pngmath'),
59-
'sphinx.ext.coverage',
60-
'sphinx.ext.doctest',
61-
'sphinx.ext.intersphinx',
62-
'sphinx.ext.todo',
63-
'sphinx.ext.ifconfig',
64-
'sphinx.ext.viewcode',
58+
"sphinx.ext.autodoc",
59+
"sphinx.ext.imgmath",
60+
"sphinx.ext.coverage",
61+
"sphinx.ext.doctest",
62+
"sphinx.ext.intersphinx",
63+
"sphinx.ext.todo",
64+
"sphinx.ext.ifconfig",
65+
"sphinx.ext.viewcode",
6566
"numpydoc.numpydoc",
66-
'matplotlib.sphinxext.plot_directive',
67-
'sphinx.ext.autosummary',
68-
'sphinx_gallery.gen_gallery',
69-
]
67+
"matplotlib.sphinxext.plot_directive",
68+
"sphinx.ext.autosummary",
69+
"sphinx_gallery.gen_gallery",
70+
]
7071
# note that the numpy directives is buggy. Example: class and init are not recognised as two entities for the autoclass_content=both here below
7172

7273

73-
todo_include_todos=True
74+
todo_include_todos = True
7475
jscopybutton_path = "copybutton.js"
75-
autoclass_content = 'both'
76+
autoclass_content = "both"
7677

7778
# Add any paths that contain templates here, relative to this directory.
78-
templates_path = ['_templates']
79+
templates_path = ["_templates"]
7980

8081
# The suffix of source filenames.
81-
source_suffix = '.rst'
82+
source_suffix = ".rst"
8283

8384
# The encoding of source files.
84-
#source_encoding = 'utf-8-sig'
85+
# source_encoding = 'utf-8-sig'
8586

8687
# The master toctree document.
87-
master_doc = 'index'
88+
master_doc = "index"
8889

8990
# General information about the project.
9091
project = project
@@ -95,34 +96,34 @@
9596
# built documents.
9697
#
9798
# The short X.Y version.
98-
version = 'Current version: ' + str(version)
99+
version = "Current version: " + str(version)
99100
# The full version, including alpha/beta/rc tags.
100101
release = release
101102

102103
# The language for content autogenerated by Sphinx. Refer to documentation
103104
# for a list of supported languages.
104-
#language = None
105+
# language = None
105106

106107
# There are two options for replacing |today|: either, you set today to some
107108
# non-false value, then it is used:
108-
#today = ''
109+
# today = ''
109110
# Else, today_fmt is used as the format for a strftime call.
110-
#today_fmt = '%B %d, %Y'
111+
# today_fmt = '%B %d, %Y'
111112

112113
# List of documents that shouldn't be included in the build.
113-
#unused_docs = []
114+
# unused_docs = []
114115

115116

116117
# List of patterns, relative to source directory, that match files and
117118
# directories to ignore when looking for source files.
118-
exclude_trees = ['_build']
119+
exclude_trees = ["_build"]
119120
exclude_patterns = []
120121

121122
# The reST default role (used for this markup: `text`) to use for all documents.
122-
#default_role = None
123+
# default_role = None
123124

124125
# If true, '()' will be appended to :func: etc. cross-reference text.
125-
#add_function_parentheses = True
126+
# add_function_parentheses = True
126127

127128
# If true, the current module name will be prepended to all description
128129
# unit titles (such as .. function::).
@@ -133,7 +134,8 @@
133134
show_authors = True
134135

135136
# The name of the Pygments (syntax highlighting) style to use.
136-
pygments_style = 'sphinx'
137+
pygments_style = "sphinx"
138+
137139

138140
# A list of ignored prefixes for module index sorting.
139141
modindex_common_prefix = ["spectrum."]
@@ -151,36 +153,15 @@
151153
numpydoc_show_class_members = False
152154

153155

154-
# solution from nilearn
155-
def touch_example_backreferences(app, what, name, obj, options, lines):
156-
# generate empty examples files, so that we don't get
157-
# inclusion errors if there are no examples for a class / module
158-
examples_path = os.path.join(app.srcdir, "modules", "generated",
159-
"%s.examples" % name)
160-
if not os.path.exists(examples_path):
161-
# touch file
162-
open(examples_path, 'w').close()
163-
164-
165-
166-
# Add the 'copybutton' javascript, to hide/show the prompt in code
167-
# examples
168-
def setup(app):
169-
app.add_javascript('copybutton.js')
170-
app.connect('autodoc-process-docstring', touch_example_backreferences)
171-
172-
173-
174-
175-
176156
# -- Options for HTML output ---------------------------------------------------
177157

178158
# The theme to use for HTML and HTML Help pages. Major themes that come with
179159
# Sphinx are currently 'default' and 'sphinxdoc'.
180160
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
181161
if not on_rtd:
182162
import sphinx_rtd_theme
183-
html_theme = 'sphinx_rtd_theme'
163+
164+
html_theme = "sphinx_rtd_theme"
184165
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
185166
else:
186167
html_theme = "default"
@@ -189,57 +170,57 @@ def setup(app):
189170
# further. For a list of options available for each theme, see the
190171
# documentation.
191172
# the user theme contains the otpions 'homepage', which is populated here
192-
#html_theme_options = {'homepage': init_sphinx.url}
173+
# html_theme_options = {'homepage': init_sphinx.url}
193174

194175
# Add any paths that contain custom themes here, relative to this directory.
195-
#html_theme_path = [easydev.get_path_sphinx_themes()]
176+
# html_theme_path = [easydev.get_path_sphinx_themes()]
196177

197178

198179
# The name for this set of Sphinx documents. If None, it defaults to
199180
# "<project> v<release> documentation".
200-
#html_title = "spectrum" + ' ('+version +')'
181+
# html_title = "spectrum" + ' ('+version +')'
201182

202183
# A shorter title for the navigation bar. Default is the same as html_title.
203184
html_short_title = "spectrum"
204185

205186
# The name of an image file (relative to this directory) to place at the top
206187
# of the sidebar.
207-
html_logo = os.path.join('logo.png')
188+
html_logo = os.path.join("logo.png")
208189

209190

210191
# The name of an image file (within the static path) to use as favicon of the
211192
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
212193
# pixels large.
213-
#html_favicon = ""
194+
# html_favicon = ""
214195

215196
# Add any paths that contain custom static files (such as style sheets) here,
216197
# relative to this directory. They are copied after the builtin static files,
217198
# so a file named "default.css" will overwrite the builtin "default.css".
218199

219-
# the copybutton.js must be copied there:
220-
html_static_path = ['_static']
200+
# the copybutton.js must be copied there:
201+
html_static_path = ["_static"]
221202

222203
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
223204
# using the given strftime format.
224-
html_last_updated_fmt = '%b %d, %Y'
205+
html_last_updated_fmt = "%b %d, %Y"
225206

226207
# If true, SmartyPants will be used to convert quotes and dashes to
227208
# typographically correct entities.
228-
#html_use_smartypants = True
209+
# html_use_smartypants = True
229210

230211
# Custom sidebar templates, maps document names to template names.
231-
html_index = 'index.html'
212+
html_index = "index.html"
232213

233-
#Custom sidebar templates, maps page names to templates.
234-
#html_sidebars = {
235-
# 'index': [ 'indexsidebar.html'],
214+
# Custom sidebar templates, maps page names to templates.
215+
# html_sidebars = {
216+
# 'index': [ 'indexsidebar.html'],
236217
# 'contents':'indexsidebar.html',#
237218
#
238219
#
239-
#}
220+
# }
240221
# Additional templates that should be rendered to pages, maps page names to
241222
# template names.
242-
#html_additional_pages = { 'index': 'index.html'}
223+
# html_additional_pages = { 'index': 'index.html'}
243224

244225

245226
# If false, no module index is generated.
@@ -259,13 +240,13 @@ def setup(app):
259240
# If true, an OpenSearch description file will be output, and all pages will
260241
# contain a <link> tag referring to it. The value of this option must be the
261242
# base URL from which the finished HTML is served.
262-
#html_use_opensearch = ''
243+
# html_use_opensearch = ''
263244

264245
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
265-
#html_file_suffix = ''
246+
# html_file_suffix = ''
266247

267248
# Output file base name for HTML help builder.
268-
htmlhelp_basename = 'doc'
249+
htmlhelp_basename = "doc"
269250

270251

271252
# -- Options for LaTeX output --------------------------------------------------
@@ -274,29 +255,28 @@ def setup(app):
274255
pngmath_use_preview = True
275256

276257
# The paper size ('letter' or 'a4').
277-
latex_paper_size = 'a4'
258+
latex_paper_size = "a4"
278259

279260
# The font size ('10pt', '11pt' or '12pt').
280-
latex_font_size = '10pt'
261+
latex_font_size = "10pt"
281262

282263
# Grouping the document tree into LaTeX files. List of tuples
283264
# (source start file, target name, title, author, documentclass [howto/manual]).
284265
latex_documents = [
285-
('index', 'main.tex', title,
286-
author, 'manual'),
266+
("index", "main.tex", title, author, "manual"),
287267
]
288268

289-
latex_elements = { 'inputenc': '\\usepackage[utf8]{inputenc}' }
269+
latex_elements = {"inputenc": "\\usepackage[utf8]{inputenc}"}
290270

291271
# The name of an image file (relative to this directory) to place at the top of
292272
# the title page.
293-
#latex_logo =
273+
# latex_logo =
294274

295275
# For "manual" documents, if this is true, then toplevel headings are parts,
296276
# not chapters.
297-
#latex_use_parts = False
277+
# latex_use_parts = False
298278
# If true, show page references after internal links.
299-
#latex_show_pagerefs = False
279+
# latex_show_pagerefs = False
300280

301281
# Additional stuff for the LaTeX preamble.
302282
latex_preamble = r"""
@@ -309,7 +289,7 @@ def setup(app):
309289
\definecolor{VerbatimBorderColor}{rgb}{0,0,0}
310290
311291
\setlength{\fboxrule}{2pt}
312-
292+
313293
\renewcommand{\Verbatim}[1][1]{%
314294
% list starts new par, but we don't want it to be set apart vertically
315295
\bgroup\parskip=0pt%
@@ -331,23 +311,20 @@ def setup(app):
331311
"""
332312

333313
# Documents to append as an appendix to all manuals.
334-
#latex_appendices = []
314+
# latex_appendices = []
335315

336316
# If false, no module index is generated.
337-
#latex_use_modindex = True
317+
# latex_use_modindex = True
338318

339319

340320
# -- Options for manual page output --------------------------------------------
341321

342322
# One entry per manual page. List of tuples
343323
# (source start file, name, description, authors, manual section).
344-
man_pages = [
345-
('index', project, project,
346-
[author], 1)
347-
]
324+
man_pages = [("index", project, project, [author], 1)]
348325

349326

350327
# Example configuration for intersphinx: refer to the Python standard library.
351328
intersphinx_mapping = {
352-
"python": ('http://docs.python.org/',None),
329+
"python": ("http://docs.python.org/", None),
353330
}

0 commit comments

Comments
 (0)