blob: 2c1c986c9f56b53a909ae21bbfd0abc93075d185 [file] [log] [blame]
Zack Williams071eda22019-05-15 18:19:51 -07001# -*- coding: utf-8 -*-
Joey Armstrong252f7122024-04-26 12:38:13 -04002# -----------------------------------------------------------------------
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 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 = (
63 "Copyright 2019-2024 Open Networking Foundation Contributors"
64)
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
Zack Williams76744322020-04-09 22:00:35 -0700127# inlcude only the branches matching master and voltha-*
Joey Armstrong252f7122024-04-26 12:38:13 -0400128smv_branch_whitelist = r"^(master|voltha-.*)$"
Zack Williams76744322020-04-09 22:00:35 -0700129
130# include all remote branches
Joey Armstrong252f7122024-04-26 12:38:13 -0400131smv_remote_whitelist = r"^.*$"
Zack Williams76744322020-04-09 22:00:35 -0700132
Zack Williams071eda22019-05-15 18:19:51 -0700133# Add any paths that contain templates here, relative to this directory.
Joey Armstrong252f7122024-04-26 12:38:13 -0400134templates_path = ["_templates"]
Zack Williams071eda22019-05-15 18:19:51 -0700135
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 Armstrong252f7122024-04-26 12:38:13 -0400140source_suffix = [".rst", ".md"]
Zack Williams071eda22019-05-15 18:19:51 -0700141
142# The master toctree document.
Joey Armstrong252f7122024-04-26 12:38:13 -0400143master_doc = "index"
Zack Williams071eda22019-05-15 18:19:51 -0700144
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.
150language = None
151
Zack Williams071eda22019-05-15 18:19:51 -0700152# The name of the Pygments (syntax highlighting) style to use.
153pygments_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 Armstrong252f7122024-04-26 12:38:13 -0400160html_theme = "sphinx_rtd_theme"
Zack Williams071eda22019-05-15 18:19:51 -0700161
Joey Armstrong252f7122024-04-26 12:38:13 -0400162html_logo = "_static/voltha.svg"
Zack Williams16042b62020-03-29 22:03:16 -0700163
Joey Armstrong252f7122024-04-26 12:38:13 -0400164html_favicon = "_static/voltha-favicon-128.png"
Zack Williams16042b62020-03-29 22:03:16 -0700165
Zack Williams071eda22019-05-15 18:19:51 -0700166# 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 Armstrong252f7122024-04-26 12:38:13 -0400170html_theme_options = {"logo_only": True}
Zack Williams071eda22019-05-15 18:19:51 -0700171
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 Armstrong252f7122024-04-26 12:38:13 -0400175html_static_path = ["_static"]
Zack Williams071eda22019-05-15 18:19:51 -0700176
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 Armstrong252f7122024-04-26 12:38:13 -0400191htmlhelp_basename = "VOLTHADocs"
Zack Williams071eda22019-05-15 18:19:51 -0700192
193
194# -- Options for LaTeX output ------------------------------------------------
195
196latex_elements = {
197 # The paper size ('letterpaper' or 'a4paper').
198 #
199 # 'papersize': 'letterpaper',
Zack Williams071eda22019-05-15 18:19:51 -0700200 # The font size ('10pt', '11pt' or '12pt').
201 #
202 # 'pointsize': '10pt',
Zack Williams071eda22019-05-15 18:19:51 -0700203 # Additional stuff for the LaTeX preamble.
204 #
205 # 'preamble': '',
Zack Williams071eda22019-05-15 18:19:51 -0700206 # 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]).
214latex_documents = [
Joey Armstrong252f7122024-04-26 12:38:13 -0400215 (master_doc, "VOLTHADocs.tex", "VOLTHA Docs", "VOLTHA Team", "manual"),
Zack Williams071eda22019-05-15 18:19:51 -0700216]
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 Armstrong252f7122024-04-26 12:38:13 -0400223man_pages = [(master_doc, "VOLTHA Docs", "VOLTHA Docs", [author], 1)]
Zack Williams071eda22019-05-15 18:19:51 -0700224
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)
231texinfo_documents = [
Joey Armstrong252f7122024-04-26 12:38:13 -0400232 (
233 master_doc,
234 "VOLTHA Docs",
235 "VOLTHA Docs",
236 author,
237 "VOLTHADocs",
238 "One line description of project.",
239 "Miscellaneous",
240 ),
Zack Williams071eda22019-05-15 18:19:51 -0700241]
242
243
244# -- Options for Epub output -------------------------------------------------
245
246# Bibliographic Dublin Core info.
247epub_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 Armstrong252f7122024-04-26 12:38:13 -0400259epub_exclude_files = ["search.html"]
Zack Williams071eda22019-05-15 18:19:51 -0700260
261
262# -- Extension configuration -------------------------------------------------
263
264# blockdiag/etc. config
265
266rackdiag_antialias = True
267rackdiag_html_image_format = "SVG"
268rackdiag_fontpath = [
269 "_static/fonts/Inconsolata-Regular.ttf",
270 "_static/fonts/Inconsolata-Bold.ttf",
271]
272
273nwdiag_antialias = True
274nwdiag_html_image_format = "SVG"
275nwdiag_fontpath = [
276 "_static/fonts/Inconsolata-Regular.ttf",
277 "_static/fonts/Inconsolata-Bold.ttf",
278]
279
Joey Armstrongbbd71d62022-10-12 11:51:35 -0400280# -- 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 Armstrong56334fc2023-01-15 22:53:19 -0500283
Joey Armstrong252f7122024-04-26 12:38:13 -0400284extlinks = {
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 Armstrongbbd71d62022-10-12 11:51:35 -0400294
Joey Armstrong2a687952023-02-01 13:10:12 -0500295# -- 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 Williams071eda22019-05-15 18:19:51 -0700303# -- Options for todo extension ----------------------------------------------
304# If true, `todo` and `todoList` produce output, else they produce nothing.
305todo_include_todos = True
306
Zack Williams071eda22019-05-15 18:19:51 -0700307# -- Configure recommonmark to use AutoStructify -----------------------------
308# Docs: https://recommonmark.readthedocs.io/en/latest/auto_structify.html
309
310import recommonmark
311from recommonmark.transform import AutoStructify
312
Joey Armstrong252f7122024-04-26 12:38:13 -0400313github_doc_root = "https://github.com/opencord/voltha-docs"
314
Zack Williams071eda22019-05-15 18:19:51 -0700315
316def setup(app):
317
Joey Armstrong252f7122024-04-26 12:38:13 -0400318 app.add_css_file("css/rtd_theme_mods.css")
Zack Williams071eda22019-05-15 18:19:51 -0700319
Joey Armstrong252f7122024-04-26 12:38:13 -0400320 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 Williams071eda22019-05-15 18:19:51 -0700328
329 app.add_transform(AutoStructify)