Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
Joey Armstrong | 0c517b5 | 2023-07-07 17:29:54 -0400 | [diff] [blame] | 2 | |
Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 3 | # Configuration file for the Sphinx documentation builder. |
| 4 | # |
| 5 | # This file does only contain a selection of the most common options. For a |
| 6 | # full list see the documentation: |
| 7 | # http://www.sphinx-doc.org/en/master/config |
| 8 | |
| 9 | # -- Path setup -------------------------------------------------------------- |
| 10 | |
| 11 | # If extensions (or modules to document with autodoc) are in another directory, |
| 12 | # add these directories to sys.path here. If the directory is relative to the |
| 13 | # documentation root, use os.path.abspath to make it absolute, like shown here. |
Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 14 | |
Joey Armstrong | 56334fc | 2023-01-15 22:53:19 -0500 | [diff] [blame] | 15 | ##-------------------## |
| 16 | ##---] IMPORTS [---## |
| 17 | ##-------------------## |
Zack Williams | 16042b6 | 2020-03-29 22:03:16 -0700 | [diff] [blame] | 18 | import os |
Joey Armstrong | 56334fc | 2023-01-15 22:53:19 -0500 | [diff] [blame] | 19 | import sys |
| 20 | from pathlib import Path |
Zack Williams | 16042b6 | 2020-03-29 22:03:16 -0700 | [diff] [blame] | 21 | |
Joey Armstrong | 0c517b5 | 2023-07-07 17:29:54 -0400 | [diff] [blame] | 22 | # -------------------------------------------------------------- |
| 23 | # Large exclusion list(s) extracted from conf.py => .sphinx/*.py |
| 24 | if True: # Set searchpath early |
| 25 | abs_path = Path('.').resolve().as_posix() |
| 26 | sys.path.insert(0, abs_path) |
| 27 | |
| 28 | # from sphinx_conf import * |
| 29 | from sphinx_conf.exclude_patterns import exclude_patterns |
| 30 | from sphinx_conf.linkcheck_ignore import linkcheck_ignore |
| 31 | # -------------------------------------------------------------- |
Joey Armstrong | 56334fc | 2023-01-15 22:53:19 -0500 | [diff] [blame] | 32 | |
| 33 | # ----------------------------------------------------------------------- |
| 34 | # ----------------------------------------------------------------------- |
Zack Williams | 16042b6 | 2020-03-29 22:03:16 -0700 | [diff] [blame] | 35 | def get_version(): |
| 36 | with open("VERSION") as f: |
| 37 | return f.read().strip() |
| 38 | |
Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 39 | # -- Project information ----------------------------------------------------- |
| 40 | |
| 41 | project = u'VOLTHA Docs' |
Joey Armstrong | 56334fc | 2023-01-15 22:53:19 -0500 | [diff] [blame] | 42 | copyright = u'Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors' |
Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 43 | author = u'VOLTHA Contributors' |
| 44 | |
| 45 | # The short X.Y version |
Zack Williams | 16042b6 | 2020-03-29 22:03:16 -0700 | [diff] [blame] | 46 | version = get_version() |
Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 47 | # The full version, including alpha/beta/rc tags |
Zack Williams | 88df474 | 2019-12-20 08:24:47 -0700 | [diff] [blame] | 48 | release = version |
Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 49 | |
| 50 | # -- General configuration --------------------------------------------------- |
| 51 | |
| 52 | # If your documentation needs a minimal Sphinx version, state it here. |
| 53 | # |
| 54 | # needs_sphinx = '1.0' |
| 55 | |
| 56 | # make all warnings errors |
| 57 | warning_is_error = True |
| 58 | |
| 59 | # Add any Sphinx extension module names here, as strings. They can be |
| 60 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
| 61 | # ones. |
| 62 | extensions = [ |
| 63 | 'recommonmark', |
| 64 | 'sphinx.ext.coverage', |
Joey Armstrong | bbd71d6 | 2022-10-12 11:51:35 -0400 | [diff] [blame] | 65 | 'sphinx.ext.extlinks', |
Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 66 | 'sphinx.ext.graphviz', |
| 67 | 'sphinx.ext.ifconfig', |
Joey Armstrong | 3980d70 | 2023-08-23 10:57:18 -0400 | [diff] [blame^] | 68 | # 'sphinx.ext.intersphinx', # :doc:`my document <../my_doc{.rst}>` |
Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 69 | 'sphinx.ext.mathjax', |
| 70 | 'sphinx.ext.todo', |
Zack Williams | c6460c2 | 2019-12-18 14:54:43 -0700 | [diff] [blame] | 71 | 'sphinxcontrib.spelling', |
Zack Williams | 16042b6 | 2020-03-29 22:03:16 -0700 | [diff] [blame] | 72 | "sphinx_multiversion", |
Matteo Scandolo | ef5d6f4 | 2020-07-27 16:46:38 -0700 | [diff] [blame] | 73 | "sphinx.ext.intersphinx", |
Andrea Campanella | c18d118 | 2021-09-10 12:01:38 +0200 | [diff] [blame] | 74 | "sphinxcontrib.openapi", |
Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 75 | ] |
| 76 | |
| 77 | # API documentation |
| 78 | # https://github.com/rtfd/sphinx-autoapi |
| 79 | # https://sphinx-autoapi.readthedocs.io |
| 80 | # autoapi_type = 'go' |
| 81 | # autoapi_dirs = [ |
| 82 | # 'voltha-go/cli/util', |
| 83 | # 'voltha-go/rw_core/config', |
| 84 | # 'voltha-go/rw_core/core', |
| 85 | # 'voltha-go/rw_core/graph', |
| 86 | # 'voltha-go/rw_core/utils', |
| 87 | # ] |
| 88 | |
Zack Williams | c6460c2 | 2019-12-18 14:54:43 -0700 | [diff] [blame] | 89 | # Text files with lists of words that shouldn't fail the spellchecker: |
| 90 | spelling_word_list_filename=['dict.txt', ] |
| 91 | |
Joey Armstrong | bbd71d6 | 2022-10-12 11:51:35 -0400 | [diff] [blame] | 92 | #sphinx-multiversion prep, run in each versioned source directory |
Zack Williams | 16042b6 | 2020-03-29 22:03:16 -0700 | [diff] [blame] | 93 | prep_commands = [ |
Zack Williams | 88df474 | 2019-12-20 08:24:47 -0700 | [diff] [blame] | 94 | 'ln -sf _root_/repos _target_/repos', |
| 95 | 'make prep', |
| 96 | ] |
| 97 | |
Zack Williams | 6b2fcf2 | 2021-09-14 06:50:44 -0700 | [diff] [blame] | 98 | # don't include tags |
Joey Armstrong | 924f3cb | 2023-06-05 15:21:51 -0400 | [diff] [blame] | 99 | # smv_tag_whitelist = None |
| 100 | # smv_tag_whitelist = disabled^ # Was = None |
| 101 | smv_tag_whitelist = 'disabled_a^' # Was = None |
Zack Williams | 6b2fcf2 | 2021-09-14 06:50:44 -0700 | [diff] [blame] | 102 | |
Zack Williams | 7674432 | 2020-04-09 22:00:35 -0700 | [diff] [blame] | 103 | # inlcude only the branches matching master and voltha-* |
| 104 | smv_branch_whitelist = r'^(master|voltha-.*)$' |
| 105 | |
| 106 | # include all remote branches |
| 107 | smv_remote_whitelist = r'^.*$' |
| 108 | |
Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 109 | # Add any paths that contain templates here, relative to this directory. |
| 110 | templates_path = ['_templates'] |
| 111 | |
| 112 | # The suffix(es) of source filenames. |
| 113 | # You can specify multiple suffix as a list of string: |
| 114 | # |
| 115 | # source_suffix = ['.rst', '.md'] |
| 116 | source_suffix = ['.rst', '.md'] |
| 117 | |
| 118 | # The master toctree document. |
| 119 | master_doc = 'index' |
| 120 | |
| 121 | # The language for content autogenerated by Sphinx. Refer to documentation |
| 122 | # for a list of supported languages. |
| 123 | # |
| 124 | # This is also used if you do content translation via gettext catalogs. |
| 125 | # Usually you set "language" from the command line for these cases. |
| 126 | language = None |
| 127 | |
Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 128 | # The name of the Pygments (syntax highlighting) style to use. |
| 129 | pygments_style = None |
| 130 | |
| 131 | # -- Options for HTML output ------------------------------------------------- |
| 132 | |
| 133 | # The theme to use for HTML and HTML Help pages. See the documentation for |
| 134 | # a list of builtin themes. |
| 135 | # |
| 136 | html_theme = 'sphinx_rtd_theme' |
| 137 | |
Zack Williams | 16042b6 | 2020-03-29 22:03:16 -0700 | [diff] [blame] | 138 | html_logo = '_static/voltha.svg' |
| 139 | |
| 140 | html_favicon = '_static/voltha-favicon-128.png' |
| 141 | |
Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 142 | # Theme options are theme-specific and customize the look and feel of a theme |
| 143 | # further. For a list of options available for each theme, see the |
| 144 | # documentation. |
| 145 | # |
Zack Williams | 16042b6 | 2020-03-29 22:03:16 -0700 | [diff] [blame] | 146 | html_theme_options = { |
| 147 | 'logo_only': True |
| 148 | } |
Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 149 | |
| 150 | # Add any paths that contain custom static files (such as style sheets) here, |
| 151 | # relative to this directory. They are copied after the builtin static files, |
| 152 | # so a file named "default.css" will overwrite the builtin "default.css". |
| 153 | html_static_path = ['_static'] |
| 154 | |
| 155 | # Custom sidebar templates, must be a dictionary that maps document names |
| 156 | # to template names. |
| 157 | # |
| 158 | # The default sidebars (for documents that don't match any pattern) are |
| 159 | # defined by theme itself. Builtin themes are using these templates by |
| 160 | # default: ``['localtoc.html', 'relations.html', 'sourcelink.html', |
| 161 | # 'searchbox.html']``. |
| 162 | # |
| 163 | # html_sidebars = {} |
| 164 | |
| 165 | |
Zack Williams | 16042b6 | 2020-03-29 22:03:16 -0700 | [diff] [blame] | 166 | |
Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 167 | # -- Options for HTMLHelp output --------------------------------------------- |
| 168 | |
| 169 | # Output file base name for HTML help builder. |
| 170 | htmlhelp_basename = 'VOLTHADocs' |
| 171 | |
| 172 | |
| 173 | # -- Options for LaTeX output ------------------------------------------------ |
| 174 | |
| 175 | latex_elements = { |
| 176 | # The paper size ('letterpaper' or 'a4paper'). |
| 177 | # |
| 178 | # 'papersize': 'letterpaper', |
| 179 | |
| 180 | # The font size ('10pt', '11pt' or '12pt'). |
| 181 | # |
| 182 | # 'pointsize': '10pt', |
| 183 | |
| 184 | # Additional stuff for the LaTeX preamble. |
| 185 | # |
| 186 | # 'preamble': '', |
| 187 | |
| 188 | # Latex figure (float) alignment |
| 189 | # |
| 190 | # 'figure_align': 'htbp', |
| 191 | } |
| 192 | |
| 193 | # Grouping the document tree into LaTeX files. List of tuples |
| 194 | # (source start file, target name, title, |
| 195 | # author, documentclass [howto, manual, or own class]). |
| 196 | latex_documents = [ |
| 197 | (master_doc, 'VOLTHADocs.tex', u'VOLTHA Docs', |
| 198 | u'VOLTHA Team', 'manual'), |
| 199 | ] |
| 200 | |
| 201 | |
| 202 | # -- Options for manual page output ------------------------------------------ |
| 203 | |
| 204 | # One entry per manual page. List of tuples |
| 205 | # (source start file, name, description, authors, manual section). |
| 206 | man_pages = [ |
| 207 | (master_doc, 'VOLTHA Docs', u'VOLTHA Docs', |
| 208 | [author], 1) |
| 209 | ] |
| 210 | |
| 211 | |
| 212 | # -- Options for Texinfo output ---------------------------------------------- |
| 213 | |
| 214 | # Grouping the document tree into Texinfo files. List of tuples |
| 215 | # (source start file, target name, title, author, |
| 216 | # dir menu entry, description, category) |
| 217 | texinfo_documents = [ |
| 218 | (master_doc, 'VOLTHA Docs', u'VOLTHA Docs', |
| 219 | author, 'VOLTHADocs', 'One line description of project.', |
| 220 | 'Miscellaneous'), |
| 221 | ] |
| 222 | |
| 223 | |
| 224 | # -- Options for Epub output ------------------------------------------------- |
| 225 | |
| 226 | # Bibliographic Dublin Core info. |
| 227 | epub_title = project |
| 228 | |
| 229 | # The unique identifier of the text. This can be a ISBN number |
| 230 | # or the project homepage. |
| 231 | # |
| 232 | # epub_identifier = '' |
| 233 | |
| 234 | # A unique identification for the text. |
| 235 | # |
| 236 | # epub_uid = '' |
| 237 | |
| 238 | # A list of files that should not be packed into the epub file. |
| 239 | epub_exclude_files = ['search.html'] |
| 240 | |
| 241 | |
| 242 | # -- Extension configuration ------------------------------------------------- |
| 243 | |
| 244 | # blockdiag/etc. config |
| 245 | |
| 246 | rackdiag_antialias = True |
| 247 | rackdiag_html_image_format = "SVG" |
| 248 | rackdiag_fontpath = [ |
| 249 | "_static/fonts/Inconsolata-Regular.ttf", |
| 250 | "_static/fonts/Inconsolata-Bold.ttf", |
| 251 | ] |
| 252 | |
| 253 | nwdiag_antialias = True |
| 254 | nwdiag_html_image_format = "SVG" |
| 255 | nwdiag_fontpath = [ |
| 256 | "_static/fonts/Inconsolata-Regular.ttf", |
| 257 | "_static/fonts/Inconsolata-Bold.ttf", |
| 258 | ] |
| 259 | |
Joey Armstrong | bbd71d6 | 2022-10-12 11:51:35 -0400 | [diff] [blame] | 260 | # -- Options for extlinks extension ------------------------------------------ |
| 261 | # ..seealso: https://www.sphinx-doc.org/en/master/usage/extensions/todo.html |
| 262 | # 'vhc' : 'https://gerrit.opencord.org/plugins/gitiles/voltha-helm-charts', |
Joey Armstrong | 56334fc | 2023-01-15 22:53:19 -0500 | [diff] [blame] | 263 | |
Joey Armstrong | bbd71d6 | 2022-10-12 11:51:35 -0400 | [diff] [blame] | 264 | extlinks=\ |
| 265 | { |
| 266 | 'vol-jira' : ('https://jira.opencord.org/projects/VOL/issues/%s', 'jira::%s'), |
Joey Armstrong | 56334fc | 2023-01-15 22:53:19 -0500 | [diff] [blame] | 267 | # macros for gerrit or github URL construction |
| 268 | 'repo' : ('https://github.com/opencord/%s', 'repo::%s'), |
Joey Armstrong | bbd71d6 | 2022-10-12 11:51:35 -0400 | [diff] [blame] | 269 | 'vol-ger' : ('https://gerrit.opencord.org/plugins/gitiles/%s', 'gerrit::%s'), |
| 270 | 'vol-git' : ('https://github.com/opencord/%s', 'git::%s'), |
| 271 | } |
| 272 | |
Joey Armstrong | 2a68795 | 2023-02-01 13:10:12 -0500 | [diff] [blame] | 273 | # -- Options for inlining a constant value ----------------------------------- |
| 274 | # NOTE: rst_prolog will affect every file in the repository. |
| 275 | # Use per-file substitution to limit scope: |
| 276 | # https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html |
| 277 | # rst_prolog = """ |
| 278 | # .. |voltha-latest| replace:: voltha-2.11 |
| 279 | # """ |
| 280 | |
Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 281 | # -- Options for todo extension ---------------------------------------------- |
| 282 | # If true, `todo` and `todoList` produce output, else they produce nothing. |
| 283 | todo_include_todos = True |
| 284 | |
Andrea Campanella | 92bd59b | 2020-01-30 17:26:32 +0100 | [diff] [blame] | 285 | # -- Options for linkcheck --------------------------------------------------- |
| 286 | # The link checker strips off .md from links and then complains |
Joey Armstrong | 0c517b5 | 2023-07-07 17:29:54 -0400 | [diff] [blame] | 287 | # linkcheck_ignore SEE .sphinx/linkcheck_ignore.py |
Andrea Campanella | 92bd59b | 2020-01-30 17:26:32 +0100 | [diff] [blame] | 288 | |
Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 289 | # -- Configure recommonmark to use AutoStructify ----------------------------- |
| 290 | # Docs: https://recommonmark.readthedocs.io/en/latest/auto_structify.html |
| 291 | |
| 292 | import recommonmark |
| 293 | from recommonmark.transform import AutoStructify |
| 294 | |
| 295 | github_doc_root = 'https://github.com/opencord/voltha-docs' |
| 296 | |
| 297 | def setup(app): |
| 298 | |
| 299 | app.add_css_file('css/rtd_theme_mods.css') |
| 300 | |
| 301 | app.add_config_value('recommonmark_config', { |
| 302 | 'url_resolver': lambda url: github_doc_root + url, |
| 303 | 'auto_toc_tree_section': 'Contents', |
| 304 | }, True) |
| 305 | |
| 306 | app.add_transform(AutoStructify) |