Test Failed
Pull Request — master (#882)
by
unknown
04:06
created

doc.source.conf   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 381
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 100
dl 0
loc 381
rs 10
c 0
b 0
f 0
wmc 3

2 Functions

Rating   Name   Duplication   Size   Complexity  
A setup() 0 7 1
A rstjinja() 0 12 2
1
# -*- coding: utf-8 -*-
2
#
3
# Savu documentation build configuration file, created by
4
# sphinx-quickstart on Tue Sep 16 10:25:51 2014.
5
#
6
# This file is execfile()d with the current directory set to its containing dir.
7
#
8
# Note that not all possible configuration values are present in this
9
# autogenerated file.
10
#
11
# All configuration values have a default; values that are commented out
12
# serve to show the default.
13
14
import os
15
import sys
16
17
from unittest import mock
18
19
# Mock imports instead of full environment in readthedocs
20
MOCK_MODULES = ["numpy",
21
                "pytest",
22
                "mpi4py",
23
                "astra",
24
                "h5py",
25
                "pandas"
26
                ]
27
28
for mod_name in MOCK_MODULES:
29
    sys.modules[mod_name] = mock.Mock()
30
31
autodoc_mock_imports = [
32
    "ccpi",
33
    "dezing", # Dezinger Deprecated
34
    "dosna",
35
    "fabio",
36
    "flupy",
37
    "GeodisTK",
38
    "larix",
39
    "morphsnakes", # MaskInitialiser MorphSnakes
40
    "mrcfile",
41
    "pmacparser", # StageMotion
42
    "peakutils",
43
    "pyfftw",
44
    "pynvml",
45
    "PyMca5",
46
    "ptypy",
47
    "pywt",
48
    "pyFAI",
49
    "ral_nlls",
50
    "scipy",
51
    "skimage",
52
    "sklearn",
53
    "speckle_matching",
54
    "setup",
55
    "tifffile",
56
    "tomopy",
57
    "tomobar",
58
    "tomophantom",
59
    "xraylib",
60
    ]
61
62
# If extensions (or modules to document with autodoc) are in another directory,
63
# add these directories to sys.path here. If the directory is relative to the
64
# documentation root, use os.path.abspath to make it absolute, like shown here.
65
66
sys.path.insert(0, os.path.abspath('../..'))
67
sys.path.insert(0, os.path.abspath('../../savu'))
68
69
import savu
70
71
print(sys.path)
72
# -- General configuration -----------------------------------------------------
73
74
keep_warnings=True
75
76
#=================== Auto-generate APIs ==============================
77
#import subprocess
78
#
79
#python create_autosummary.py api autosummary.rst
80
##python create_autosummary.py api_plugin_dev dev_autosummary.rst
81
#DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
82
#echo $DIR
83
#export SPHINX_APIDOC_OPTIONS='members,private-members,undoc-members,show-inheritance'
84
#sphinx-apidoc -fMeTP $DIR/../ -o $DIR/source/api
85
#export SPHINX_APIDOC_OPTIONS='members,undoc-members,noindex'
86
#sphinx-apidoc -feT $DIR/../ -o $DIR/source/api_plugin_dev
87
#python create_dev_autosummary.py
88
#sphinx-build -a -E -j 2 -b html $DIR/source/ $DIR/build/
89
#
90
#
91
#def run_apidoc(_):
92
#    # get all module directories here
93
#    modules = ['a_list_of',
94
#               'python_module_directories',
95
#               'in_your_project']
96
#    for module in modules:
97
#        cur_dir = os.path.abspath(os.path.dirname(__file__))
98
#        output_path = os.path.join(cur_dir, module, 'doc')
99
#        cmd_path = 'sphinx-apidoc'
100
#        if hasattr(sys, 'real_prefix'):  # Check to see if we are in a virtualenv
101
#            # If we are, assemble the path manually
102
#            cmd_path = os.path.abspath(os.path.join(sys.prefix, 'bin', 'sphinx-apidoc'))
103
#        subprocess.check_call([cmd_path, '-e', '-o', output_path, module, '--force'])
104
#
105
#def setup(app):
106
#    app.connect('builder-inited', run_apidoc)
107
#=================== Auto-generate APIs ==============================
108
109
# If your documentation needs a minimal Sphinx version, state it here.
110
#needs_sphinx = '1.0'
111
112
# Add any Sphinx extension module names here, as strings. They can be extensions
113
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
114
extensions = [
115
    # Generates api files
116
    "sphinx.ext.autodoc",
117
    # Generates a short summary from docstring
118
    "sphinx.ext.autosummary",
119
    # Allows parsing of google style docstrings
120
    "sphinx.ext.napoleon",
121
    # Add links to highlighted source code
122
    "sphinx.ext.viewcode",
123
    # Documents command line tools with argparser library
124
    "sphinxarg.ext",
125
    # Allows a grid layout and dropdown boxes
126
    "sphinx_panels",
127
]
128
autosummary_generate = True
129
130
# Add any paths that contain templates here, relative to this directory.
131
templates_path = ['_templates']
132
133
# The suffix of source filenames.
134
source_suffix = '.rst'
135
136
# The encoding of source files.
137
#source_encoding = 'utf-8-sig'
138
139
# The master toctree document.
140
master_doc = 'index'
141
142
# General information about the project.
143
project = 'Savu'
144
copyright = '2014, Mark Basham'
145
146
# The version info for the project you're documenting, acts as replacement for
147
# |version| and |release|, also used in various other places throughout the
148
# built documents.
149
150
from savu.version import __version__
151
152
# The short X.Y version.
153
version = __version__
154
# The full version, including alpha/beta/rc tags.
155
release = __version__
156
157
# The language for content autogenerated by Sphinx. Refer to documentation
158
# for a list of supported languages.
159
#language = None
160
161
# There are two options for replacing |today|: either, you set today to some
162
# non-false value, then it is used:
163
#today = ''
164
# Else, today_fmt is used as the format for a strftime call.
165
#today_fmt = '%B %d, %Y'
166
167
# List of patterns, relative to source directory, that match files and
168
# directories to ignore when looking for source files.
169
#exclude_patterns = ['_templates', '', '../../savu/test',
170
#                    '../../savu/core/transports/dist_array_transport.py',
171
#                    'setup.py', 'install']
172
exclude_patterns = ['api_plugin/savu.test*', 'api_plugin/setup*']
173
174
# The reST default role (used for this markup: `text`) to use for all documents.
175
#default_role = None
176
177
# If true, '()' will be appended to :func: etc. cross-reference text.
178
#add_function_parentheses = True
179
180
# If true, the current module name will be prepended to all description
181
# unit titles (such as .. function::).
182
add_module_names = False
183
184
# If true, sectionauthor and moduleauthor directives will be shown in the
185
# output. They are ignored by default.
186
#show_authors = False
187
188
# The name of the Pygments (syntax highlighting) style to use.
189
pygments_style = 'sphinx'
190
191
# A list of ignored prefixes for module index sorting.
192
#modindex_common_prefix = ['savu.']
193
194
195
# -- Options for HTML output ---------------------------------------------------
196
197
# The theme to use for HTML and HTML Help pages.  See the documentation for
198
# a list of builtin themes.
199
html_theme = 'sphinx_rtd_theme'
200
201
# Theme options are theme-specific and customize the look and feel of a theme
202
# further.  For a list of options available for each theme, see the
203
# documentation.
204
#html_theme_options = {}
205
206
# Add any paths that contain custom themes here, relative to this directory.
207
html_theme_path = ["_themes", ]
208
209
# The name for this set of Sphinx documents.  If None, it defaults to
210
# "<project> v<release> documentation".
211
#html_title = None
212
213
# A shorter title for the navigation bar.  Default is the same as html_title.
214
#html_short_title = None
215
216
# The name of an image file (relative to this directory) to place at the top
217
# of the sidebar.
218
#html_logo = 'files_and_images/Savu_black_square_downsample2.png'
219
file_path =  os.path.dirname(os.path.realpath(__file__)).split('/doc/')[0]
220
html_logo = file_path + '/doc/source/files_and_images/logo_downsample.png'
221
222
# The name of an image file (within the static path) to use as favicon of the
223
# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
224
# pixels large.
225
#html_favicon = None
226
227
# Add any paths that contain custom static files (such as style sheets) here,
228
# relative to this directory. They are copied after the builtin static files,
229
# so a file named "default.css" will overwrite the builtin "default.css".
230
html_static_path = ['_static']
231
232
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
233
# using the given strftime format.
234
#html_last_updated_fmt = '%b %d, %Y'
235
236
# If true, SmartyPants will be used to convert quotes and dashes to
237
# typographically correct entities.
238
#html_use_smartypants = True
239
240
# Custom sidebar templates, maps document names to template names.
241
#html_sidebars = {}
242
243
# Additional templates that should be rendered to pages, maps page names to
244
# template names.
245
#html_additional_pages = {}
246
247
# If false, no module index is generated.
248
#html_domain_indices = True
249
250
# If false, no index is generated.
251
#html_use_index = True
252
253
# If true, the index is split into individual pages for each letter.
254
#html_split_index = False
255
256
# If true, links to the reST sources are added to the pages.
257
#html_show_sourcelink = True
258
259
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
260
#html_show_sphinx = True
261
262
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
263
#html_show_copyright = True
264
265
# If true, an OpenSearch description file will be output, and all pages will
266
# contain a <link> tag referring to it.  The value of this option must be the
267
# base URL from which the finished HTML is served.
268
#html_use_opensearch = ''
269
270
# This is the file name suffix for HTML files (e.g. ".xhtml").
271
#html_file_suffix = None
272
273
# Output file base name for HTML help builder.
274
htmlhelp_basename = 'Savudoc'
275
276
277
# -- Options for LaTeX output --------------------------------------------------
278
279
latex_elements = {
280
# The paper size ('letterpaper' or 'a4paper').
281
#'papersize': 'letterpaper',
282
283
# The font size ('10pt', '11pt' or '12pt').
284
#'pointsize': '10pt',
285
286
# Additional stuff for the LaTeX preamble.
287
#'preamble': '',
288
}
289
290
# Grouping the document tree into LaTeX files. List of tuples
291
# (source start file, target name, title, author, documentclass [howto/manual]).
292
latex_documents = [
293
  ('index', 'Savu.tex', 'Savu Documentation',
294
   'Mark Basham', 'manual'),
295
]
296
297
# The name of an image file (relative to this directory) to place at the top of
298
# the title page.
299
#latex_logo = None
300
301
# For "manual" documents, if this is true, then toplevel headings are parts,
302
# not chapters.
303
#latex_use_parts = False
304
305
# If true, show page references after internal links.
306
#latex_show_pagerefs = False
307
308
# If true, show URL addresses after external links.
309
#latex_show_urls = False
310
311
# Documents to append as an appendix to all manuals.
312
#latex_appendices = []
313
314
# If false, no module index is generated.
315
#latex_domain_indices = True
316
317
318
# -- Options for manual page output --------------------------------------------
319
320
# One entry per manual page. List of tuples
321
# (source start file, name, description, authors, manual section).
322
man_pages = [
323
    ('index', 'savu', 'Savu Documentation',
324
     ['Mark Basham'], 1)
325
]
326
327
# If true, show URL addresses after external links.
328
#man_show_urls = False
329
330
331
# -- Options for Texinfo output ------------------------------------------------
332
333
# Grouping the document tree into Texinfo files. List of tuples
334
# (source start file, target name, title, author,
335
#  dir menu entry, description, category)
336
texinfo_documents = [
337
    (
338
        "index",
339
        "Savu",
340
        "Savu Documentation",
341
        "Mark Basham",
342
        "Savu",
343
        "One line description of project.",
344
        "Miscellaneous",
345
    ),
346
]
347
348
# Documents to append as an appendix to all manuals.
349
#texinfo_appendices = []
350
351
# If false, no module index is generated.
352
#texinfo_domain_indices = True
353
354
# How to display URL addresses: 'footnote', 'no', or 'inline'.
355
#texinfo_show_urls = 'footnote'
356
357
358
# Example configuration for intersphinx: refer to the Python standard library.
359
intersphinx_mapping = {"http://docs.python.org/": None}
360
361
def rstjinja(app, docname, source):
362
    """
363
    Render the pages as jinja templates
364
    """
365
    # Make sure we're outputting HTML
366
    if app.builder.format != 'html':
367
        return
368
    src = source[0]
369
    rendered = app.builder.templates.render_string(
370
        src, app.config.html_context
371
    )
372
    source[0] = rendered
373
374
def setup(app):
375
    # General width and navigation bar format
376
    app.add_css_file("css/general.css")
377
    # Style for plugin template pages
378
    app.add_css_file("css/plugin_template.css")
379
    app.add_css_file("css/plugin_template_download.css")
380
    app.connect("source-read", rstjinja)
381
382
383