-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconf.py
More file actions
309 lines (246 loc) · 10.7 KB
/
conf.py
File metadata and controls
309 lines (246 loc) · 10.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
"""
Configuration file for the Sphinx documentation builder.
This file only contains a selection of the most common options. For a full
list see the documentation:
https://www.sphinx-doc.org/en/master/usage/configuration.html
"""
import datetime
import sys
from urllib.parse import urljoin
# Sphinx extention to format xarray/pandas summaries
import sphinx_autosummary_accessors
from jinja2.defaults import DEFAULT_FILTERS
from packaging.version import Version
import waveform_editor
print("python exec:", sys.executable)
print("sys.path:", sys.path)
# -- Project information -----------------------------------------------------
# The documented project’s name
project = src_project = PROJECT = "Waveform-Editor"
# A copyright statement in the style '2008, Author Name'.
copyright = f"2020-{datetime.datetime.now().year}, ITER Organization"
# The author name(s) of the document
author = "ITER Organization"
src_host = "https://github.com/iterorganization/"
# Parse urls here for convenience, to be re-used
# ITER docs
iter_projects = "https://github.com/iterorganization/"
dd_url = urljoin(iter_projects, "imas-data-dictionary/")
al_url = urljoin(iter_projects, "imas-core/")
issue_url = jira_url = f"{iter_projects}/{src_project}/issues"
# Waveform Editor
repository_url = f"{iter_projects}/{src_project}/"
blob_url = repository_url
mr_url = urljoin(repository_url, "/pulls")
# Configuration of sphinx.ext.extlinks
# See https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html
# unique name: (base URL, label prefix)
extlinks = {
"src": (blob_url + "%s", "%s"),
"issue": (issue_url + "%s", "%s"),
"merge": (mr_url + "%s", "!%s"),
"dd": (dd_url + "%s", "%s"),
"al": (al_url + "%s", "%s"),
"pypa": ("https://packaging.python.org/%s", None),
}
full_version = Version(waveform_editor.__version__)
# version: The major project version, used as the replacement for |version|.
# For example, for the Python documentation, this may be something like 2.6.
version = full_version.base_version
# release: The full project version, used as the replacement for |release| and
# e.g. in the HTML templates. For example, for the Python documentation, this
# may be something like 2.6.0rc1
release = str(full_version)
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.autodoc", # To auto-generate docs from Python docstrings
"sphinx.ext.todo", # Support for todo items
"sphinx.ext.napoleon", # Support for NumPy and Google style docstrings
"sphinx.ext.intersphinx", # Generate links to other documentation files
"sphinx.ext.autosummary", # For summarizing autodoc-generated files
"sphinx.ext.extlinks", # For shortening internal links
"sphinx.ext.mathjax", # Render math as images
"sphinx_immaterial", # Sphinx immaterial theme
]
todo_include_todos = True
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates", sphinx_autosummary_accessors.templates_path]
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
# The master toctree document.
master_doc = "index"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = "en"
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store","generated/waveform_editor.cli._excepthook.rst"]
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
# today = ''
# Else, today_fmt is used as the format for a strftime call.
today_fmt = "%Y-%m-%d"
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = "sphinx_immaterial"
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
# and
# https://sphinx-immaterial.readthedocs.io/en/latest/customization.html#confval-html_theme_options
html_theme_options = {
"repo_url": "https://github.com/iterorganization/Waveform-Editor",
"repo_name": "Waveform-Editor",
"icon": {
"repo": "fontawesome/brands/github",
},
"features": [
# "navigation.expand",
# "navigation.tabs",
"navigation.sections",
"navigation.instant",
# "header.autohide",
"navigation.top",
# "navigation.tracking",
# "search.highlight",
# "search.share",
# "toc.integrate",
"toc.follow",
"toc.sticky",
# "content.tabs.link",
"announce.dismiss",
],
# "toc_title_is_page_title": True,
# "globaltoc_collapse": True,
"palette": [
{
"media": "(prefers-color-scheme: light)",
"scheme": "default",
"primary": "indigo",
"accent": "green",
"toggle": {
"icon": "material/lightbulb-outline",
"name": "Switch to dark mode",
},
},
{
"media": "(prefers-color-scheme: dark)",
"scheme": "slate",
"primary": "light-blue",
"accent": "lime",
"toggle": {
"icon": "material/lightbulb",
"name": "Switch to light mode",
},
},
],
}
# Shorten Table Of Contents in API documentation
object_description_options = [
(".*", dict(include_fields_in_toc=False)),
(".*parameter", dict(include_in_toc=False)),
]
# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# '<project> v<release> documentation'.
# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
# html_logo = "_static/imas_200x200.png"
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
# html_favicon = "_static/favicon.ico"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named 'default.css' will overwrite the builtin 'default.css'.
html_static_path = ["_static"]
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
# html_extra_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
html_last_updated_fmt = today_fmt
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
# html_additional_pages = {}
# If false, no module index is generated.
# html_domain_indices = True
# If false, no index is generated.
# html_use_index = True
# If true, the index is split into individual pages for each letter.
# html_split_index = False
# If true, links to the reST sources are added to the pages.
# html_show_sourcelink = True
# If true, 'Created using Sphinx' is shown in the HTML footer. Default is True.
# html_show_sphinx = True
# If true, '(C) Copyright ...' is shown in the HTML footer. Default is True.
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. '.xhtml').
# html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = "waveform_editor_doc"
# -- Extension configuration -------------------------------------------------
# Configuration of sphinx.ext.autodoc
# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
autodoc_typehints = "signature"
# The documentation for these external import give errors, so we mock them
autodoc_mock_imports = ["vtkmodules", "paraview","vtk"]
# Configuration of sphinx.ext.autosummary
# https://www.sphinx-doc.org/en/master/usage/extensions/autosummary.html
autosummary_generate = True
# Configuration of sphinx.ext.napoleon
# https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html
# Support for NumPy and Google style docstrings
napoleon_google_docstring = True
napoleon_numpy_docstring = False
# Allow PEP 526 attributes annotations in classes:
napoleon_attr_annotations = True
# Configuration of sphinx.ext.intersphinx
# https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html
intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"numpy": ("https://numpy.org/doc/stable", None),
"scipy": ("https://docs.scipy.org/doc/scipy/", None),
"packaging": ("https://packaging.pypa.io/en/stable/", None),
}
intersphinx_timeout = 60 # Downloads time out after 1 minute
smartquotes = False
# Configuration of sphinx.ext.mathjax
# https://www.sphinx-doc.org/en/master/usage/extensions/math.html#module-sphinx.ext.mathjax
def escape_underscores(string):
return string.replace("_", r"\_")
# Get around issue where param contains an invalid docstring
def patch_param_docstring(app, what, name, obj, options, lines):
for i, line in enumerate(lines):
if "**params" in line:
lines[i] = line.replace("**params", "``**params``")
def setup(app):
DEFAULT_FILTERS["escape_underscores"] = escape_underscores
app.add_css_file("waveform_editor.css")
app.connect("autodoc-process-docstring", patch_param_docstring)