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