Skip to content

Commit 167bdce

Browse files
committed
[doc/conf] Update sphinx build
- use readthedocs theme - use copyright from 'info.json'
1 parent 4ae235c commit 167bdce

File tree

1 file changed

+63
-61
lines changed

1 file changed

+63
-61
lines changed

doc/conf.py

Lines changed: 63 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818

1919
from distutils.version import LooseVersion as CheckVer
2020

21-
currdir = os.path.dirname(os.path.abspath(__file__))
22-
parent = pathlib.Path(currdir).parent
23-
path = os.path.join(parent, "odml", "info.json")
21+
_currdir = os.path.dirname(os.path.abspath(__file__))
22+
_parent = pathlib.Path(_currdir).parent
23+
_path = os.path.join(_parent, "odml", "info.json")
2424

25-
with open(path) as infofile:
26-
infodict = json.load(infofile)
25+
with open(_path) as infofile:
26+
_infodict = json.load(infofile)
2727

28-
version_str = infodict["VERSION"]
28+
VERSION_STR = _infodict["VERSION"]
29+
COPY_RIGHT = _infodict["COPYRIGHT"]
2930

3031
# If extensions (or modules to document with autodoc) are in another directory,
3132
# add these directories to sys.path here. If the directory is relative to the
@@ -34,198 +35,199 @@
3435

3536

3637
class DocStringInheritor(type):
37-
"""A variation on
38+
"""
39+
A variation on
3840
http://groups.google.com/group/comp.lang.python/msg/26f7b4fcb4d66c95
3941
by Paul McGuire
4042
"""
4143
def __new__(meta, name, bases, clsdict):
4244
if not('__doc__' in clsdict and clsdict['__doc__']):
4345
for mro_cls in (mro_cls for base in bases for mro_cls in base.mro()):
44-
doc=mro_cls.__doc__
46+
doc = mro_cls.__doc__
4547
if doc:
46-
clsdict['__doc__']=doc
48+
clsdict['__doc__'] = doc
4749
break
4850
for attr, attribute in clsdict.items():
4951
if not attribute.__doc__:
5052
for mro_cls in (mro_cls for base in bases for mro_cls in base.mro()
5153
if hasattr(mro_cls, attr)):
52-
doc=getattr(getattr(mro_cls,attr),'__doc__')
54+
doc = getattr(getattr(mro_cls, attr), '__doc__')
5355
if doc:
54-
attribute.__doc__=doc
56+
attribute.__doc__ = doc
5557
break
5658
return type.__new__(meta, name, bases, clsdict)
5759

60+
5861
# -- General configuration -----------------------------------------------------
5962

6063
# Add any Sphinx extension module names here, as strings. They can be extensions
6164
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
62-
extensions = ['sphinx.ext.autodoc']
65+
extensions = ["sphinx.ext.autodoc", "sphinx_rtd_theme"]
6366

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

6770
# The suffix of source filenames.
68-
source_suffix = '.rst'
71+
source_suffix = ".rst"
6972

7073
# The encoding of source files.
71-
#source_encoding = 'utf-8'
74+
# source_encoding = 'utf-8'
7275

7376
# The master toctree document.
74-
master_doc = 'index'
77+
master_doc = "index"
7578

7679
# General information about the project.
77-
project = u'python-odml'
78-
copyright = u'2011-2020, German Neuroinformatics Node (G-Node); based on work by Hagen Fritsch'
80+
project = "python-odml"
81+
copyright = COPY_RIGHT
7982

8083
# The version info for the project you're documenting, acts as replacement for
8184
# |version| and |release|, also used in various other places throughout the
8285
# built documents.
8386
#
8487
# The short X.Y version.
85-
version = "%s.%s" % (CheckVer(version_str).version[0], CheckVer(version_str).version[1])
88+
version = "%s.%s" % (CheckVer(VERSION_STR).version[0], CheckVer(VERSION_STR).version[1])
8689
# The full version, including alpha/beta/rc tags.
87-
release = version_str
90+
release = VERSION_STR
8891

8992
# The language for content autogenerated by Sphinx. Refer to documentation
9093
# for a list of supported languages.
91-
#language = None
94+
# language = None
9295

9396
# There are two options for replacing |today|: either, you set today to some
9497
# non-false value, then it is used:
95-
#today = ''
98+
# today = ''
9699
# Else, today_fmt is used as the format for a strftime call.
97-
#today_fmt = '%B %d, %Y'
100+
# today_fmt = '%B %d, %Y'
98101

99102
# List of documents that shouldn't be included in the build.
100-
#unused_docs = []
103+
# unused_docs = []
101104

102105
# List of directories, relative to source directory, that shouldn't be searched
103106
# for source files.
104-
exclude_trees = ['_build']
107+
exclude_trees = ["_build"]
105108

106109
# The reST default role (used for this markup: `text`) to use for all documents.
107-
#default_role = None
110+
# default_role = None
108111

109112
# If true, '()' will be appended to :func: etc. cross-reference text.
110-
#add_function_parentheses = True
113+
# add_function_parentheses = True
111114

112115
# If true, the current module name will be prepended to all description
113116
# unit titles (such as .. function::).
114-
#add_module_names = True
117+
# add_module_names = True
115118

116119
# If true, sectionauthor and moduleauthor directives will be shown in the
117120
# output. They are ignored by default.
118-
#show_authors = False
121+
# show_authors = False
119122

120123
# The name of the Pygments (syntax highlighting) style to use.
121-
pygments_style = 'sphinx'
124+
pygments_style = "sphinx"
122125

123126
# A list of ignored prefixes for module index sorting.
124-
#modindex_common_prefix = []
127+
# modindex_common_prefix = []
125128

126129

127130
# -- Options for HTML output ---------------------------------------------------
128131

129132
# The theme to use for HTML and HTML Help pages. Major themes that come with
130133
# Sphinx are currently 'default' and 'sphinxdoc'.
131-
html_theme = 'sphinxdoc'
134+
# html_theme = "sphinxdoc"
135+
html_theme = "sphinx_rtd_theme"
132136

133137
# Theme options are theme-specific and customize the look and feel of a theme
134138
# further. For a list of options available for each theme, see the
135139
# documentation.
136-
#html_theme_options = {}
140+
# html_theme_options = {}
137141

138142
# Add any paths that contain custom themes here, relative to this directory.
139-
#html_theme_path = []
143+
# html_theme_path = []
140144

141145
# The name for this set of Sphinx documents. If None, it defaults to
142146
# "<project> v<release> documentation".
143-
#html_title = None
147+
# html_title = None
144148

145149
# A shorter title for the navigation bar. Default is the same as html_title.
146-
#html_short_title = None
150+
# html_short_title = None
147151

148152
# The name of an image file (relative to this directory) to place at the top
149153
# of the sidebar.
150-
#html_logo = None
154+
# html_logo = None
151155

152156
# The name of an image file (within the static path) to use as favicon of the
153157
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
154158
# pixels large.
155-
#html_favicon = None
159+
# html_favicon = None
156160

157161
# Add any paths that contain custom static files (such as style sheets) here,
158162
# relative to this directory. They are copied after the builtin static files,
159163
# so a file named "default.css" will overwrite the builtin "default.css".
160-
html_static_path = ['_static']
164+
html_static_path = ["_static"]
161165

162166
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
163167
# using the given strftime format.
164-
#html_last_updated_fmt = '%b %d, %Y'
168+
# html_last_updated_fmt = '%b %d, %Y'
165169

166170
# If true, SmartyPants will be used to convert quotes and dashes to
167171
# typographically correct entities.
168-
#html_use_smartypants = True
172+
# html_use_smartypants = True
169173

170174
# Custom sidebar templates, maps document names to template names.
171-
#html_sidebars = {}
175+
# html_sidebars = {}
172176

173177
# Additional templates that should be rendered to pages, maps page names to
174178
# template names.
175-
#html_additional_pages = {}
179+
# html_additional_pages = {}
176180

177181
# If false, no module index is generated.
178-
#html_use_modindex = True
182+
# html_use_modindex = True
179183

180184
# If false, no index is generated.
181-
#html_use_index = True
185+
# html_use_index = True
182186

183187
# If true, the index is split into individual pages for each letter.
184-
#html_split_index = False
188+
# html_split_index = False
185189

186190
# If true, links to the reST sources are added to the pages.
187-
#html_show_sourcelink = True
191+
# html_show_sourcelink = True
188192

189193
# If true, an OpenSearch description file will be output, and all pages will
190194
# contain a <link> tag referring to it. The value of this option must be the
191195
# base URL from which the finished HTML is served.
192-
#html_use_opensearch = ''
196+
# html_use_opensearch = ''
193197

194198
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
195-
#html_file_suffix = ''
199+
# html_file_suffix = ''
196200

197201
# Output file base name for HTML help builder.
198-
htmlhelp_basename = 'python-odmldoc'
202+
htmlhelp_basename = "python-odmldoc"
199203

200204

201205
# -- Options for LaTeX output --------------------------------------------------
202206

203207
# The paper size ('letter' or 'a4').
204-
#latex_paper_size = 'letter'
208+
# latex_paper_size = 'letter'
205209

206210
# The font size ('10pt', '11pt' or '12pt').
207-
#latex_font_size = '10pt'
211+
# latex_font_size = '10pt'
208212

209213
# Grouping the document tree into LaTeX files. List of tuples
210214
# (source start file, target name, title, author, documentclass [howto/manual]).
211-
latex_documents = [
212-
('index', 'python-odml.tex', u'python-odml Documentation',
213-
u'Hagen Fritsch', 'manual'),
214-
]
215+
latex_documents = [('index', 'python-odml.tex', u'python-odml Documentation',
216+
u'Hagen Fritsch', 'manual')]
215217

216218
# The name of an image file (relative to this directory) to place at the top of
217219
# the title page.
218-
#latex_logo = None
220+
# latex_logo = None
219221

220222
# For "manual" documents, if this is true, then toplevel headings are parts,
221223
# not chapters.
222-
#latex_use_parts = False
224+
# latex_use_parts = False
223225

224226
# Additional stuff for the LaTeX preamble.
225-
#latex_preamble = ''
227+
# latex_preamble = ''
226228

227229
# Documents to append as an appendix to all manuals.
228-
#latex_appendices = []
230+
# latex_appendices = []
229231

230232
# If false, no module index is generated.
231-
#latex_use_modindex = True
233+
# latex_use_modindex = True

0 commit comments

Comments
 (0)