xref: /honee/conf.py (revision 5f46bb16c0b10bf7c44b7ec1cbefc5d9b473e8b6)
1965d9f74SJames Wright#!/usr/bin/env python3
2965d9f74SJames Wright# -*- coding: utf-8 -*-
3965d9f74SJames Wright#
4965d9f74SJames Wright# HONEE documentation build configuration file
5965d9f74SJames Wright#
6965d9f74SJames Wright# This file is execfile()d with the current directory set to its
7965d9f74SJames Wright# containing dir.
8965d9f74SJames Wright#
9965d9f74SJames Wright# Note that not all possible configuration values are present in this
10965d9f74SJames Wright# autogenerated file.
11965d9f74SJames Wright#
12965d9f74SJames Wright# All configuration values have a default; values that are commented out
13965d9f74SJames Wright# serve to show the default.
14965d9f74SJames Wright
15965d9f74SJames Wright# If extensions (or modules to document with autodoc) are in another directory,
16965d9f74SJames Wright# add these directories to sys.path here. If the directory is relative to the
17965d9f74SJames Wright# documentation root, use os.path.abspath to make it absolute, like shown here.
18965d9f74SJames Wright#
19965d9f74SJames Wright# import os
20965d9f74SJames Wright# import sys
21965d9f74SJames Wright# sys.path.insert(0, os.path.abspath('.'))
22965d9f74SJames Wrightimport glob
23965d9f74SJames Wrightimport shutil
24965d9f74SJames Wrightimport sys
25965d9f74SJames Wrightimport breathe
26965d9f74SJames Wrightimport os
27965d9f74SJames Wrightfrom pathlib import Path
28965d9f74SJames Wrightimport subprocess
29965d9f74SJames Wrightfrom sphinxcontrib import katex
30965d9f74SJames Wright
31965d9f74SJames Wright# -- General configuration ------------------------------------------------
32965d9f74SJames Wright
33965d9f74SJames Wright# If your documentation needs a minimal Sphinx version, state it here.
34965d9f74SJames Wright#
35965d9f74SJames Wright# needs_sphinx = '1.0'
36965d9f74SJames Wright
37965d9f74SJames Wright# Add any Sphinx extension module names here, as strings. They can be
38965d9f74SJames Wright# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
39965d9f74SJames Wright# ones.
40965d9f74SJames Wrightextensions = [
41965d9f74SJames Wright    'sphinxext_altair.altairplot',
42965d9f74SJames Wright    'breathe',
43965d9f74SJames Wright    'hoverxref.extension',
44965d9f74SJames Wright    'sphinx_design',
45965d9f74SJames Wright    'myst_parser',
46965d9f74SJames Wright    'sphinx.ext.autodoc',
47965d9f74SJames Wright    'sphinx.ext.coverage',
48965d9f74SJames Wright    'sphinx.ext.doctest',
49965d9f74SJames Wright    'sphinx.ext.ifconfig',
50965d9f74SJames Wright    'sphinx.ext.intersphinx',
51965d9f74SJames Wright    'sphinx.ext.githubpages',
52965d9f74SJames Wright    'sphinxcontrib.katex',
53965d9f74SJames Wright    'sphinxcontrib.mermaid',  # still in beta; fails with latexpdf builder
54965d9f74SJames Wright    'sphinx.ext.todo',
55965d9f74SJames Wright    'sphinx.ext.viewcode',
56965d9f74SJames Wright    'sphinxcontrib.bibtex',
57965d9f74SJames Wright    'sphinxcontrib.rsvgconverter',
58965d9f74SJames Wright]
59965d9f74SJames Wright
60965d9f74SJames Wright# The following, if true, allows figures, tables and code-blocks to be
61965d9f74SJames Wright# automatically numbered if they have a caption.
62965d9f74SJames Wrightnumfig = True
63965d9f74SJames Wright
64965d9f74SJames Wright# Add any paths that contain templates here, relative to this directory.
65965d9f74SJames Wright# templates_path = ['_templates']
66965d9f74SJames Wright
67965d9f74SJames Wright# The master toctree document.
68965d9f74SJames Wrightmaster_doc = 'index'
69965d9f74SJames Wright
70965d9f74SJames Wright# General information about the project.
71965d9f74SJames Wrightproject = 'HONEE'
72965d9f74SJames Wrightcopyright = '2024, University of Colorado, LLNS, and other authors'
73efbf6ca3SJames Wrightwith open(Path('AUTHORS')) as f:
74efbf6ca3SJames Wright    authorlist = f.readlines()
75efbf6ca3SJames Wrightauthor = ', '.join(authorlist)
76965d9f74SJames Wright
77965d9f74SJames Wright# # The version info for the project you're documenting, acts as replacement for
78965d9f74SJames Wright# # |version| and |release|, also used in various other places throughout the
79965d9f74SJames Wright# # built documents.
80965d9f74SJames Wright# #
81965d9f74SJames Wright# # The short X.Y version.
82965d9f74SJames Wright# with open(Path('ratel.pc.template')) as f:
83965d9f74SJames Wright#     pkgconf_version = 'unknown'
84965d9f74SJames Wright#     for line in f:
85965d9f74SJames Wright#         if line.startswith('Version:'):
86965d9f74SJames Wright#             pkgconf_version = line.partition(': ')[2]
87965d9f74SJames Wright#             break
88965d9f74SJames Wright# version = pkgconf_version
89965d9f74SJames Wright# # The full version, including alpha/beta/rc tags.
90965d9f74SJames Wright# release = pkgconf_version
91965d9f74SJames Wright
92965d9f74SJames Wright# The language for content autogenerated by Sphinx. Refer to documentation
93965d9f74SJames Wright# for a list of supported languages.
94965d9f74SJames Wright#
95965d9f74SJames Wright# This is also used if you do content translation via gettext catalogs.
96965d9f74SJames Wright# Usually you set "language" from the command line for these cases.
97965d9f74SJames Wrightlanguage = 'en'
98965d9f74SJames Wright
99965d9f74SJames Wright# List of patterns, relative to source directory, that match files and
100965d9f74SJames Wright# directories to ignore when looking for source files.
101965d9f74SJames Wright# This patterns also effect to html_static_path and html_extra_path
102965d9f74SJames Wrightexclude_patterns = [
103965d9f74SJames Wright    '.gitlab',
104965d9f74SJames Wright    'VENV*',
105965d9f74SJames Wright    'tests/junit-xml/*',
106965d9f74SJames Wright    'tests/README.md',
107965d9f74SJames Wright    'tests/createPyTorchModel/README.md',
108965d9f74SJames Wright    'RELEASING.md',
109965d9f74SJames Wright]
110965d9f74SJames Wright
111965d9f74SJames Wright# The name of the Pygments (syntax highlighting) style to use.
112965d9f74SJames Wrightpygments_style = 'sphinx'
113965d9f74SJames Wright
114965d9f74SJames Wright# If true, `todo` and `todoList` produce output, else they produce nothing.
115965d9f74SJames Wrighttodo_include_todos = True
116965d9f74SJames Wright
117965d9f74SJames Wright# sphinxcontrib-bibtex 2.0 requires listing all bibtex files here
118965d9f74SJames Wrightbibtex_bibfiles = ['doc/references.bib']
119965d9f74SJames Wright
120965d9f74SJames Wrightmyst_enable_extensions = [
121965d9f74SJames Wright    'deflist',
122965d9f74SJames Wright    'dollarmath',
123965d9f74SJames Wright    'html_image',
124965d9f74SJames Wright    'linkify',
125965d9f74SJames Wright    'colon_fence',
126965d9f74SJames Wright]
127965d9f74SJames Wright
128965d9f74SJames Wrightmyst_heading_anchors = 2
129965d9f74SJames Wright# Note: The config value `myst_url_schemes' defaults to type `list'
130965d9f74SJames Wrightmyst_url_schemes = ['http', 'https', 'mailto']
131965d9f74SJames Wright
132965d9f74SJames Wright# -- Options for HTML output ----------------------------------------------
133965d9f74SJames Wright
134965d9f74SJames Wright# The theme to use for HTML and HTML Help pages.  See the documentation for
135965d9f74SJames Wright# a list of builtin themes.
136965d9f74SJames Wrighthtml_theme = 'furo'
137965d9f74SJames Wright
138965d9f74SJames Wright# Project logo
139965d9f74SJames Wright# html_logo = 'doc/img/logo.png'
140965d9f74SJames Wright
141965d9f74SJames Wright# Project favicon
142965d9f74SJames Wright# html_favicon = 'doc/img/logo.ico'
143965d9f74SJames Wright
144965d9f74SJames Wright# Theme options are theme-specific and customize the look and feel of a theme
145965d9f74SJames Wright# further.  For a list of options available for each theme, see the
146965d9f74SJames Wright# documentation.
147965d9f74SJames Wright#
148965d9f74SJames Wright# html_theme_options = {}
149965d9f74SJames Wright
150965d9f74SJames Wright# Add any paths that contain custom static files (such as style sheets) here,
151965d9f74SJames Wright# relative to this directory. They are copied after the builtin static files,
152965d9f74SJames Wright# so a file named "default.css" will overwrite the builtin "default.css".
153965d9f74SJames Wrighthtml_static_path = ['doc/css']
154965d9f74SJames Wright
155965d9f74SJames Wright# hoverxref options
156965d9f74SJames Wrighthoverxref_auto_ref = True
157965d9f74SJames Wrighthoverxref_mathjax = True
158965d9f74SJames Wrighthoverxref_role_types = {
159965d9f74SJames Wright    'ref': 'modal',
160965d9f74SJames Wright}
161965d9f74SJames Wright
162965d9f74SJames Wrightlatex_macros = r"""
163965d9f74SJames Wright\def \diff {\operatorname{d}\!}
164965d9f74SJames Wright\def \tcolon {\!:\!}
165965d9f74SJames Wright\def \trace {\operatorname{trace}}
166965d9f74SJames Wright\def \sign {\operatorname{sign}}
167*b30619f6SJames Wright\def \Pe {\mathrm{Pe}}
168*b30619f6SJames Wright\def \CFL {\mathrm{CFL}}
169*b30619f6SJames Wright\def \gbar #1{\overline{g}_{#1}}
170*b30619f6SJames Wright\def \mean {\braket}
171*b30619f6SJames Wright\def \dt {\Delta t}
172965d9f74SJames Wright"""
173965d9f74SJames Wright
174965d9f74SJames Wright# Translate LaTeX macros to KaTeX and add to options for HTML builder
175965d9f74SJames Wrightkatex_macros = katex.latex_defs_to_katex_macros(latex_macros)
176965d9f74SJames Wrightkatex_options = 'macros: {' + katex_macros + '}'
177965d9f74SJames Wright
178965d9f74SJames Wright# -- Options for HTMLHelp output ------------------------------------------
179965d9f74SJames Wright
180965d9f74SJames Wright# Output file base name for HTML help builder.
181965d9f74SJames Wrighthtmlhelp_basename = 'HONEEdoc'
182965d9f74SJames Wright
183965d9f74SJames Wright
184965d9f74SJames Wright# -- Options for LaTeX output ---------------------------------------------
185965d9f74SJames Wright
186965d9f74SJames Wrightlatex_engine = 'lualatex'
187965d9f74SJames Wright
188965d9f74SJames Wrightlatex_elements = {
189965d9f74SJames Wright    # The paper size ('letterpaper' or 'a4paper').
190965d9f74SJames Wright    #
191965d9f74SJames Wright    # 'papersize': 'letterpaper',
192965d9f74SJames Wright
193965d9f74SJames Wright    # The font size ('10pt', '11pt' or '12pt').
194965d9f74SJames Wright    #
195965d9f74SJames Wright    # 'pointsize': '10pt',
196965d9f74SJames Wright
197965d9f74SJames Wright    # Additional stuff for the LaTeX preamble.
198965d9f74SJames Wright    #
199965d9f74SJames Wright    'preamble': r"""
200965d9f74SJames Wright\usepackage{amscd}
201965d9f74SJames Wright\newcommand\bm[1]{\symbf{#1}}
202965d9f74SJames Wright""" + latex_macros,
203965d9f74SJames Wright
204965d9f74SJames Wright    # Latex figure (float) alignment
205965d9f74SJames Wright    #
206965d9f74SJames Wright    # 'figure_align': 'htbp',
207965d9f74SJames Wright    'fontpkg': r"""
208965d9f74SJames Wright\usepackage[math-style=ISO,bold-style=ISO]{unicode-math}
209965d9f74SJames Wright\setmainfont{TeX Gyre Pagella}
210965d9f74SJames Wright\setmathfont{TeX Gyre Pagella Math}
211965d9f74SJames Wright\setsansfont{DejaVu Sans}
212965d9f74SJames Wright\setmonofont{DejaVu Sans Mono}
213965d9f74SJames Wright""",
214965d9f74SJames Wright}
215965d9f74SJames Wright
216965d9f74SJames Wright# latex_logo = 'doc/img/logo.jpg'
217965d9f74SJames Wright
218efbf6ca3SJames Wrightlatexauthorslist = r' \and '.join(authorlist)
219965d9f74SJames Wright
220965d9f74SJames Wright# Grouping the document tree into LaTeX files. List of tuples
221965d9f74SJames Wright# (source start file, target name, title,
222965d9f74SJames Wright#  author, documentclass [howto, manual, or own class]).
223965d9f74SJames Wrightlatex_documents = [
224965d9f74SJames Wright    (master_doc, 'honee.tex', 'HONEE User Manual', latexauthorslist, 'howto'),
225965d9f74SJames Wright]
226965d9f74SJames Wright
227965d9f74SJames Wright# -- Options for manual page output ---------------------------------------
228965d9f74SJames Wright
229965d9f74SJames Wright# One entry per manual page. List of tuples
230965d9f74SJames Wright# (source start file, name, description, authors, manual section).
231965d9f74SJames Wrightman_pages = [
232965d9f74SJames Wright    (master_doc, 'honee', 'HONEE User Manual', [author], 1)
233965d9f74SJames Wright]
234965d9f74SJames Wright
235965d9f74SJames Wright# -- Options for Texinfo output -------------------------------------------
236965d9f74SJames Wright
237965d9f74SJames Wright# Grouping the document tree into Texinfo files. List of tuples
238965d9f74SJames Wright# (source start file, target name, title, author,
239965d9f74SJames Wright#  dir menu entry, description, category)
240965d9f74SJames Wrighttexinfo_documents = [
241965d9f74SJames Wright    (master_doc, 'honee', 'HONEE User Manual', latexauthorslist, 'HONEE', 'High-Order Navier-stokes Equation Evaluator'),
242965d9f74SJames Wright]
243965d9f74SJames Wright
244965d9f74SJames Wright# -- Options for Epub output ----------------------------------------------
245965d9f74SJames Wright
246965d9f74SJames Wright# Bibliographic Dublin Core info.
247965d9f74SJames Wrightepub_title = project
248965d9f74SJames Wrightepub_author = author
249965d9f74SJames Wrightepub_publisher = author
250965d9f74SJames Wrightepub_copyright = copyright
251965d9f74SJames Wright
252965d9f74SJames Wright# The unique identifier of the text. This can be a ISBN number
253965d9f74SJames Wright# or the project homepage.
254965d9f74SJames Wright#
255965d9f74SJames Wright# epub_identifier = ''
256965d9f74SJames Wright
257965d9f74SJames Wright# A unique identification for the text.
258965d9f74SJames Wright#
259965d9f74SJames Wright# epub_uid = ''
260965d9f74SJames Wright
261965d9f74SJames Wright# A list of files that should not be packed into the epub file.
262965d9f74SJames Wrightepub_exclude_files = ['search.html']
263965d9f74SJames Wright
264965d9f74SJames Wright
265965d9f74SJames Wright# Example configuration for intersphinx: refer to the Python standard library.
266965d9f74SJames Wrightintersphinx_mapping = {
267965d9f74SJames Wright    'python': ('https://docs.python.org/3', None),
268965d9f74SJames Wright    'numpy': ('https://numpy.org/devdocs', None),
269965d9f74SJames Wright}
270965d9f74SJames Wright
271965d9f74SJames Wright
272965d9f74SJames Wright# -- Options for breathe --------------------------------------------------
273965d9f74SJames Wrightbreathe_projects = {'HONEE': 'xml'}
274965d9f74SJames Wrightbreathe_default_project = 'HONEE'
275965d9f74SJames Wrightbreathe_build_directory = 'doc/build/breathe'
276965d9f74SJames Wrightbreathe_domain_by_extension = {'c': 'c', 'h': 'c', 'cpp': 'cpp', 'hpp': 'cpp'}
277965d9f74SJames Wrightbreathe_show_define_initializer = True
278