blob: 1433792ddd9d2ac86f7336facff9bf960786d4d3 [file] [log] [blame]
Zack Williams071eda22019-05-15 18:19:51 -07001# -*- coding: utf-8 -*-
Joey Armstrong252f7122024-04-26 12:38:13 -04002# -----------------------------------------------------------------------
Serkant Uluderya6db98942026-03-26 09:53:57 -07003# Copyright 2019-2026 Linux Foundation Broadband Contributors
Joey Armstrong252f7122024-04-26 12:38:13 -04004#
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# -----------------------------------------------------------------------
Serkant Uluderya6db98942026-03-26 09:53:57 -070017# SPDX-FileCopyrightText: 2019-2026 Linux Foundation Broadband Contributors
Joey Armstrong252f7122024-04-26 12:38:13 -040018# SPDX-License-Identifier: Apache-2.0
19# -----------------------------------------------------------------------
20# Intent:
21# -----------------------------------------------------------------------
Joey Armstrong0c517b52023-07-07 17:29:54 -040022
Zack Williams071eda22019-05-15 18:19:51 -070023# 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 Williams071eda22019-05-15 18:19:51 -070034
Joey Armstrong56334fc2023-01-15 22:53:19 -050035##-------------------##
36##---] IMPORTS [---##
37##-------------------##
Zack Williams16042b62020-03-29 22:03:16 -070038import os
Joey Armstrong56334fc2023-01-15 22:53:19 -050039import sys
40from pathlib import Path
Zack Williams16042b62020-03-29 22:03:16 -070041
Joey Armstrong0c517b52023-07-07 17:29:54 -040042# --------------------------------------------------------------
43# Large exclusion list(s) extracted from conf.py => .sphinx/*.py
Joey Armstrong252f7122024-04-26 12:38:13 -040044if True: # Set searchpath early
45 abs_path = Path(".").resolve().as_posix()
Joey Armstrong0c517b52023-07-07 17:29:54 -040046 sys.path.insert(0, abs_path)
47
Joey Armstrong252f7122024-04-26 12:38:13 -040048# -- Options for linkcheck ----------------------------------------------
Joey Armstrong0c517b52023-07-07 17:29:54 -040049from sphinx_conf.exclude_patterns import exclude_patterns
50from sphinx_conf.linkcheck_ignore import linkcheck_ignore
Joey Armstrong56334fc2023-01-15 22:53:19 -050051
52# -----------------------------------------------------------------------
53# -----------------------------------------------------------------------
Zack Williams16042b62020-03-29 22:03:16 -070054def get_version():
55 with open("VERSION") as f:
56 return f.read().strip()
57
Joey Armstrong252f7122024-04-26 12:38:13 -040058
Zack Williams071eda22019-05-15 18:19:51 -070059# -- Project information -----------------------------------------------------
60
Joey Armstrong252f7122024-04-26 12:38:13 -040061project = "VOLTHA Docs"
62copyright = (
Serkant Uluderya6db98942026-03-26 09:53:57 -070063 "Copyright 2019-2025 Linux Foundation Broadband Contributors"
Joey Armstrong252f7122024-04-26 12:38:13 -040064)
65author = "VOLTHA Contributors"
Zack Williams071eda22019-05-15 18:19:51 -070066
67# The short X.Y version
Zack Williams16042b62020-03-29 22:03:16 -070068version = get_version()
Zack Williams071eda22019-05-15 18:19:51 -070069# The full version, including alpha/beta/rc tags
Zack Williams88df4742019-12-20 08:24:47 -070070release = version
Zack Williams071eda22019-05-15 18:19:51 -070071
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
79warning_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.
84extensions = [
Joey Armstrong252f7122024-04-26 12:38:13 -040085 "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 Williams16042b62020-03-29 22:03:16 -070094 "sphinx_multiversion",
Matteo Scandoloef5d6f42020-07-27 16:46:38 -070095 "sphinx.ext.intersphinx",
Andrea Campanellac18d1182021-09-10 12:01:38 +020096 "sphinxcontrib.openapi",
Zack Williams071eda22019-05-15 18:19:51 -070097]
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 Williamsc6460c22019-12-18 14:54:43 -0700111# Text files with lists of words that shouldn't fail the spellchecker:
Joey Armstrong252f7122024-04-26 12:38:13 -0400112spelling_word_list_filename = [
113 "dict.txt",
114]
Zack Williamsc6460c22019-12-18 14:54:43 -0700115
Joey Armstrong252f7122024-04-26 12:38:13 -0400116# sphinx-multiversion prep, run in each versioned source directory
Zack Williams16042b62020-03-29 22:03:16 -0700117prep_commands = [
Joey Armstrong252f7122024-04-26 12:38:13 -0400118 "ln -sf _root_/repos _target_/repos",
119 "make prep",
Zack Williams88df4742019-12-20 08:24:47 -0700120]
121
Zack Williams6b2fcf22021-09-14 06:50:44 -0700122# don't include tags
Joey Armstrong924f3cb2023-06-05 15:21:51 -0400123# smv_tag_whitelist = None
124# smv_tag_whitelist = disabled^ # Was = None
Joey Armstrong252f7122024-04-26 12:38:13 -0400125smv_tag_whitelist = "disabled_a^" # Was = None
Zack Williams6b2fcf22021-09-14 06:50:44 -0700126
serkant.uluderya0600fd12026-04-09 17:55:08 -0700127# Exclude voltha-2.4 and voltha-2.5: their Makefiles clone the kind-voltha
128# repository which no longer exists, causing multiversion builds to fail.
129# All other voltha-* branches do not reference kind-voltha and build cleanly.
130smv_branch_whitelist = r"^(master|voltha-2\.(?!4$|5$)\d.*)$"
Zack Williams76744322020-04-09 22:00:35 -0700131
132# include all remote branches
Joey Armstrong252f7122024-04-26 12:38:13 -0400133smv_remote_whitelist = r"^.*$"
Zack Williams76744322020-04-09 22:00:35 -0700134
Zack Williams071eda22019-05-15 18:19:51 -0700135# Add any paths that contain templates here, relative to this directory.
Joey Armstrong252f7122024-04-26 12:38:13 -0400136templates_path = ["_templates"]
Zack Williams071eda22019-05-15 18:19:51 -0700137
138# The suffix(es) of source filenames.
139# You can specify multiple suffix as a list of string:
140#
141# source_suffix = ['.rst', '.md']
Joey Armstrong252f7122024-04-26 12:38:13 -0400142source_suffix = [".rst", ".md"]
Zack Williams071eda22019-05-15 18:19:51 -0700143
144# The master toctree document.
Joey Armstrong252f7122024-04-26 12:38:13 -0400145master_doc = "index"
Zack Williams071eda22019-05-15 18:19:51 -0700146
147# The language for content autogenerated by Sphinx. Refer to documentation
148# for a list of supported languages.
149#
150# This is also used if you do content translation via gettext catalogs.
151# Usually you set "language" from the command line for these cases.
Eric Ball69713112025-04-02 12:11:47 -0700152language = "en"
Zack Williams071eda22019-05-15 18:19:51 -0700153
Zack Williams071eda22019-05-15 18:19:51 -0700154# The name of the Pygments (syntax highlighting) style to use.
155pygments_style = None
156
157# -- Options for HTML output -------------------------------------------------
158
159# The theme to use for HTML and HTML Help pages. See the documentation for
160# a list of builtin themes.
161#
Joey Armstrong252f7122024-04-26 12:38:13 -0400162html_theme = "sphinx_rtd_theme"
Zack Williams071eda22019-05-15 18:19:51 -0700163
Joey Armstrong252f7122024-04-26 12:38:13 -0400164html_logo = "_static/voltha.svg"
Zack Williams16042b62020-03-29 22:03:16 -0700165
Joey Armstrong252f7122024-04-26 12:38:13 -0400166html_favicon = "_static/voltha-favicon-128.png"
Zack Williams16042b62020-03-29 22:03:16 -0700167
Zack Williams071eda22019-05-15 18:19:51 -0700168# Theme options are theme-specific and customize the look and feel of a theme
169# further. For a list of options available for each theme, see the
170# documentation.
171#
Joey Armstrong252f7122024-04-26 12:38:13 -0400172html_theme_options = {"logo_only": True}
Zack Williams071eda22019-05-15 18:19:51 -0700173
174# Add any paths that contain custom static files (such as style sheets) here,
175# relative to this directory. They are copied after the builtin static files,
176# so a file named "default.css" will overwrite the builtin "default.css".
Joey Armstrong252f7122024-04-26 12:38:13 -0400177html_static_path = ["_static"]
Zack Williams071eda22019-05-15 18:19:51 -0700178
179# Custom sidebar templates, must be a dictionary that maps document names
180# to template names.
181#
182# The default sidebars (for documents that don't match any pattern) are
183# defined by theme itself. Builtin themes are using these templates by
184# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
185# 'searchbox.html']``.
186#
187# html_sidebars = {}
188
189
190# -- Options for HTMLHelp output ---------------------------------------------
191
192# Output file base name for HTML help builder.
Joey Armstrong252f7122024-04-26 12:38:13 -0400193htmlhelp_basename = "VOLTHADocs"
Zack Williams071eda22019-05-15 18:19:51 -0700194
195
196# -- Options for LaTeX output ------------------------------------------------
197
198latex_elements = {
199 # The paper size ('letterpaper' or 'a4paper').
200 #
201 # 'papersize': 'letterpaper',
Zack Williams071eda22019-05-15 18:19:51 -0700202 # The font size ('10pt', '11pt' or '12pt').
203 #
204 # 'pointsize': '10pt',
Zack Williams071eda22019-05-15 18:19:51 -0700205 # Additional stuff for the LaTeX preamble.
206 #
207 # 'preamble': '',
Zack Williams071eda22019-05-15 18:19:51 -0700208 # Latex figure (float) alignment
209 #
210 # 'figure_align': 'htbp',
211}
212
213# Grouping the document tree into LaTeX files. List of tuples
214# (source start file, target name, title,
215# author, documentclass [howto, manual, or own class]).
216latex_documents = [
Joey Armstrong252f7122024-04-26 12:38:13 -0400217 (master_doc, "VOLTHADocs.tex", "VOLTHA Docs", "VOLTHA Team", "manual"),
Zack Williams071eda22019-05-15 18:19:51 -0700218]
219
220
221# -- Options for manual page output ------------------------------------------
222
223# One entry per manual page. List of tuples
224# (source start file, name, description, authors, manual section).
Joey Armstrong252f7122024-04-26 12:38:13 -0400225man_pages = [(master_doc, "VOLTHA Docs", "VOLTHA Docs", [author], 1)]
Zack Williams071eda22019-05-15 18:19:51 -0700226
227
228# -- Options for Texinfo output ----------------------------------------------
229
230# Grouping the document tree into Texinfo files. List of tuples
231# (source start file, target name, title, author,
232# dir menu entry, description, category)
233texinfo_documents = [
Joey Armstrong252f7122024-04-26 12:38:13 -0400234 (
235 master_doc,
236 "VOLTHA Docs",
237 "VOLTHA Docs",
238 author,
239 "VOLTHADocs",
240 "One line description of project.",
241 "Miscellaneous",
242 ),
Zack Williams071eda22019-05-15 18:19:51 -0700243]
244
245
246# -- Options for Epub output -------------------------------------------------
247
248# Bibliographic Dublin Core info.
249epub_title = project
250
251# The unique identifier of the text. This can be a ISBN number
252# or the project homepage.
253#
254# epub_identifier = ''
255
256# A unique identification for the text.
257#
258# epub_uid = ''
259
260# A list of files that should not be packed into the epub file.
Joey Armstrong252f7122024-04-26 12:38:13 -0400261epub_exclude_files = ["search.html"]
Zack Williams071eda22019-05-15 18:19:51 -0700262
263
264# -- Extension configuration -------------------------------------------------
265
266# blockdiag/etc. config
267
268rackdiag_antialias = True
269rackdiag_html_image_format = "SVG"
270rackdiag_fontpath = [
271 "_static/fonts/Inconsolata-Regular.ttf",
272 "_static/fonts/Inconsolata-Bold.ttf",
273]
274
275nwdiag_antialias = True
276nwdiag_html_image_format = "SVG"
277nwdiag_fontpath = [
278 "_static/fonts/Inconsolata-Regular.ttf",
279 "_static/fonts/Inconsolata-Bold.ttf",
280]
281
Joey Armstrongbbd71d62022-10-12 11:51:35 -0400282# -- Options for extlinks extension ------------------------------------------
283# ..seealso: https://www.sphinx-doc.org/en/master/usage/extensions/todo.html
Eric Ball74a2e762025-08-27 12:34:53 -0700284# 'vhc' : 'https://gerrit.lfbroadband.org/plugins/gitiles/voltha-helm-charts',
Joey Armstrong56334fc2023-01-15 22:53:19 -0500285
Joey Armstrong252f7122024-04-26 12:38:13 -0400286extlinks = {
Eric Balle0d83ed2025-02-06 13:35:38 -0800287 "vol-jira": ("https://lf-broadband.atlassian.net/projects/VOL/issues/%s", "jira::%s"),
288 "jira-browse": ("https://lf-broadband.atlassian.net/browse/%s", "jira::%s"),
Joey Armstrong252f7122024-04-26 12:38:13 -0400289 # macros for gerrit or github URL construction
290 "repo": ("https://github.com/opencord/%s", "repo::%s"),
Eric Ball74a2e762025-08-27 12:34:53 -0700291 "vol-ger": ("https://gerrit.lfbroadband.org/plugins/gitiles/%s", "gerrit::%s"),
Joey Armstrong252f7122024-04-26 12:38:13 -0400292 "vol-git": ("https://github.com/opencord/%s", "git::%s"),
293 # https://mvnrepository
Eric Ball4cc56b02025-03-25 12:36:33 -0700294 "mvn-cord": ("https://mvnrepository.com/artifact/org.opencord/%s", "mvn::%s"),
295 "vol-docker": ("https://hub.docker.com/r/voltha/%s", "%s"),
Joey Armstrong252f7122024-04-26 12:38:13 -0400296}
Joey Armstrongbbd71d62022-10-12 11:51:35 -0400297
Joey Armstrong2a687952023-02-01 13:10:12 -0500298# -- Options for inlining a constant value -----------------------------------
299# NOTE: rst_prolog will affect every file in the repository.
300# Use per-file substitution to limit scope:
301# https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
302# rst_prolog = """
303# .. |voltha-latest| replace:: voltha-2.11
304# """
305
Zack Williams071eda22019-05-15 18:19:51 -0700306# -- Options for todo extension ----------------------------------------------
307# If true, `todo` and `todoList` produce output, else they produce nothing.
308todo_include_todos = True
309
Zack Williams071eda22019-05-15 18:19:51 -0700310# -- Configure recommonmark to use AutoStructify -----------------------------
311# Docs: https://recommonmark.readthedocs.io/en/latest/auto_structify.html
312
313import recommonmark
314from recommonmark.transform import AutoStructify
315
Joey Armstrong252f7122024-04-26 12:38:13 -0400316github_doc_root = "https://github.com/opencord/voltha-docs"
317
Zack Williams071eda22019-05-15 18:19:51 -0700318
319def setup(app):
320
Joey Armstrong252f7122024-04-26 12:38:13 -0400321 app.add_css_file("css/rtd_theme_mods.css")
Zack Williams071eda22019-05-15 18:19:51 -0700322
Joey Armstrong252f7122024-04-26 12:38:13 -0400323 app.add_config_value(
324 "recommonmark_config",
325 {
326 "url_resolver": lambda url: github_doc_root + url,
327 "auto_toc_tree_section": "Contents",
328 },
329 True,
330 )
Zack Williams071eda22019-05-15 18:19:51 -0700331
332 app.add_transform(AutoStructify)