-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconf.py
206 lines (159 loc) · 5.55 KB
/
conf.py
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# MLBench documentation build configuration file, created by
# sphinx-quickstart on Sun Nov 2 21:31:04 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
#
# Imports
#
import sys
import os
from os.path import abspath, join, dirname
sys.path.insert(0, abspath(join(dirname(__file__))))
# -- RTD configuration ------------------------------------------------
# on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
# This is used for linking and such so we link to the thing we're building
rtd_version = os.environ.get("READTHEDOCS_VERSION", "latest")
if rtd_version not in ["stable", "latest", "develop"]:
rtd_version = "stable"
# -- 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",
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
"sphinxcontrib.httpdomain",
"sphinxcontrib.bibtex",
]
bibtex_bibfiles = ['benchmark-tasks.bib']
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
# The suffix of source filenames.
source_suffix = ".rst"
# The master toctree document.
master_doc = "index"
# General information about the project.
project = "MLBench"
copyright = "2020 MLBench development team"
# TODO: detect this at
# rtd_version = 'latest'
intersphinx_mapping = {
"mlbench-helm": (
"https://mlbench.readthedocs.io/projects/mlbench_helm/en/%s/" % rtd_version,
None,
),
"dashboard": (
"https://mlbench.readthedocs.io/projects/mlbench_dashboard/en/%s/"
% rtd_version,
None,
),
"mlbench-benchmarks": (
"https://mlbench.readthedocs.io/projects/mlbench_benchmarks/en/%s/"
% rtd_version,
None,
),
"core": (
"https://mlbench.readthedocs.io/projects/mlbench_core/en/%s/" % rtd_version,
None,
),
}
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = "2020"
# The full version, including alpha/beta/rc tags.
release = version
autoclass_content = "both"
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ["_build"]
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"
# -- 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 = "default"
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
else:
html_theme = "default"
# Output file base name for HTML help builder.
htmlhelp_basename = "MLBench"
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(
"index",
"MLBench.tex",
"MLBench Documentation",
"MLBench development team",
"manual",
),
]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(
"index",
"MLBench",
"MLBench Documentation",
"MLBench development team",
"MLBench",
"One line description of project.",
"Miscellaneous",
),
]
# -- Options for Epub output ----------------------------------------------
# Bibliographic Dublin Core info.
epub_title = "MLBench"
epub_author = "MLBench development team"
epub_publisher = "MLBench development team"
epub_copyright = "2014-2016, MLBench development team"
# A list of files that should not be packed into the epub file.
epub_exclude_files = ["search.html"]
# -- Custom Document processing ----------------------------------------------
import gensidebar
gensidebar.generate_sidebar(globals(), "mlbench")
import sphinx.addnodes
import docutils.nodes
def process_child(node):
"""This function changes class references to not have the
intermediate module name by hacking at the doctree"""
# Edit descriptions to be nicer
if isinstance(node, sphinx.addnodes.desc_addname):
if len(node.children) == 1:
child = node.children[0]
text = child.astext()
# Edit literals to be nicer
elif isinstance(node, docutils.nodes.literal):
child = node.children[0]
text = child.astext()
for child in node.children:
process_child(child)
def doctree_read(app, doctree):
for child in doctree.children:
process_child(child)
def setup(app):
app.connect("doctree-read", doctree_read)