xref: /honee/conf.py (revision 965d9f743f86785935177ec2ff1624a7b09e04f8)
1*965d9f74SJames Wright#!/usr/bin/env python3
2*965d9f74SJames Wright# -*- coding: utf-8 -*-
3*965d9f74SJames Wright#
4*965d9f74SJames Wright# HONEE documentation build configuration file
5*965d9f74SJames Wright#
6*965d9f74SJames Wright# This file is execfile()d with the current directory set to its
7*965d9f74SJames Wright# containing dir.
8*965d9f74SJames Wright#
9*965d9f74SJames Wright# Note that not all possible configuration values are present in this
10*965d9f74SJames Wright# autogenerated file.
11*965d9f74SJames Wright#
12*965d9f74SJames Wright# All configuration values have a default; values that are commented out
13*965d9f74SJames Wright# serve to show the default.
14*965d9f74SJames Wright
15*965d9f74SJames Wright# If extensions (or modules to document with autodoc) are in another directory,
16*965d9f74SJames Wright# add these directories to sys.path here. If the directory is relative to the
17*965d9f74SJames Wright# documentation root, use os.path.abspath to make it absolute, like shown here.
18*965d9f74SJames Wright#
19*965d9f74SJames Wright# import os
20*965d9f74SJames Wright# import sys
21*965d9f74SJames Wright# sys.path.insert(0, os.path.abspath('.'))
22*965d9f74SJames Wrightimport glob
23*965d9f74SJames Wrightimport shutil
24*965d9f74SJames Wrightimport sys
25*965d9f74SJames Wrightimport breathe
26*965d9f74SJames Wrightimport os
27*965d9f74SJames Wrightfrom pathlib import Path
28*965d9f74SJames Wrightimport subprocess
29*965d9f74SJames Wrightfrom sphinxcontrib import katex
30*965d9f74SJames Wright
31*965d9f74SJames Wright# -- General configuration ------------------------------------------------
32*965d9f74SJames Wright
33*965d9f74SJames Wright# If your documentation needs a minimal Sphinx version, state it here.
34*965d9f74SJames Wright#
35*965d9f74SJames Wright# needs_sphinx = '1.0'
36*965d9f74SJames Wright
37*965d9f74SJames Wright# Add any Sphinx extension module names here, as strings. They can be
38*965d9f74SJames Wright# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
39*965d9f74SJames Wright# ones.
40*965d9f74SJames Wrightextensions = [
41*965d9f74SJames Wright    'sphinxext_altair.altairplot',
42*965d9f74SJames Wright    'breathe',
43*965d9f74SJames Wright    'hoverxref.extension',
44*965d9f74SJames Wright    'sphinx_design',
45*965d9f74SJames Wright    'myst_parser',
46*965d9f74SJames Wright    'sphinx.ext.autodoc',
47*965d9f74SJames Wright    'sphinx.ext.coverage',
48*965d9f74SJames Wright    'sphinx.ext.doctest',
49*965d9f74SJames Wright    'sphinx.ext.ifconfig',
50*965d9f74SJames Wright    'sphinx.ext.intersphinx',
51*965d9f74SJames Wright    'sphinx.ext.githubpages',
52*965d9f74SJames Wright    'sphinxcontrib.katex',
53*965d9f74SJames Wright    'sphinxcontrib.mermaid',  # still in beta; fails with latexpdf builder
54*965d9f74SJames Wright    'sphinx.ext.todo',
55*965d9f74SJames Wright    'sphinx.ext.viewcode',
56*965d9f74SJames Wright    'sphinxcontrib.bibtex',
57*965d9f74SJames Wright    'sphinxcontrib.rsvgconverter',
58*965d9f74SJames Wright]
59*965d9f74SJames Wright
60*965d9f74SJames Wright# The following, if true, allows figures, tables and code-blocks to be
61*965d9f74SJames Wright# automatically numbered if they have a caption.
62*965d9f74SJames Wrightnumfig = True
63*965d9f74SJames Wright
64*965d9f74SJames Wright# Add any paths that contain templates here, relative to this directory.
65*965d9f74SJames Wright# templates_path = ['_templates']
66*965d9f74SJames Wright
67*965d9f74SJames Wright# The master toctree document.
68*965d9f74SJames Wrightmaster_doc = 'index'
69*965d9f74SJames Wright
70*965d9f74SJames Wright# General information about the project.
71*965d9f74SJames Wrightproject = 'HONEE'
72*965d9f74SJames Wrightcopyright = '2024, University of Colorado, LLNS, and other authors'
73*965d9f74SJames Wright# with open(Path('AUTHORS')) as f:
74*965d9f74SJames Wright#     authorlist = f.readlines()
75*965d9f74SJames Wright# author = ', '.join(authorlist)
76*965d9f74SJames Wrightauthor = ''
77*965d9f74SJames Wright
78*965d9f74SJames Wright# # The version info for the project you're documenting, acts as replacement for
79*965d9f74SJames Wright# # |version| and |release|, also used in various other places throughout the
80*965d9f74SJames Wright# # built documents.
81*965d9f74SJames Wright# #
82*965d9f74SJames Wright# # The short X.Y version.
83*965d9f74SJames Wright# with open(Path('ratel.pc.template')) as f:
84*965d9f74SJames Wright#     pkgconf_version = 'unknown'
85*965d9f74SJames Wright#     for line in f:
86*965d9f74SJames Wright#         if line.startswith('Version:'):
87*965d9f74SJames Wright#             pkgconf_version = line.partition(': ')[2]
88*965d9f74SJames Wright#             break
89*965d9f74SJames Wright# version = pkgconf_version
90*965d9f74SJames Wright# # The full version, including alpha/beta/rc tags.
91*965d9f74SJames Wright# release = pkgconf_version
92*965d9f74SJames Wright
93*965d9f74SJames Wright# The language for content autogenerated by Sphinx. Refer to documentation
94*965d9f74SJames Wright# for a list of supported languages.
95*965d9f74SJames Wright#
96*965d9f74SJames Wright# This is also used if you do content translation via gettext catalogs.
97*965d9f74SJames Wright# Usually you set "language" from the command line for these cases.
98*965d9f74SJames Wrightlanguage = 'en'
99*965d9f74SJames Wright
100*965d9f74SJames Wright# List of patterns, relative to source directory, that match files and
101*965d9f74SJames Wright# directories to ignore when looking for source files.
102*965d9f74SJames Wright# This patterns also effect to html_static_path and html_extra_path
103*965d9f74SJames Wrightexclude_patterns = [
104*965d9f74SJames Wright    '.gitlab',
105*965d9f74SJames Wright    'VENV*',
106*965d9f74SJames Wright    'tests/junit-xml/*',
107*965d9f74SJames Wright    'tests/README.md',
108*965d9f74SJames Wright    'tests/createPyTorchModel/README.md',
109*965d9f74SJames Wright    'RELEASING.md',
110*965d9f74SJames Wright]
111*965d9f74SJames Wright
112*965d9f74SJames Wright# The name of the Pygments (syntax highlighting) style to use.
113*965d9f74SJames Wrightpygments_style = 'sphinx'
114*965d9f74SJames Wright
115*965d9f74SJames Wright# If true, `todo` and `todoList` produce output, else they produce nothing.
116*965d9f74SJames Wrighttodo_include_todos = True
117*965d9f74SJames Wright
118*965d9f74SJames Wright# sphinxcontrib-bibtex 2.0 requires listing all bibtex files here
119*965d9f74SJames Wrightbibtex_bibfiles = ['doc/references.bib']
120*965d9f74SJames Wright
121*965d9f74SJames Wrightmyst_enable_extensions = [
122*965d9f74SJames Wright    'deflist',
123*965d9f74SJames Wright    'dollarmath',
124*965d9f74SJames Wright    'html_image',
125*965d9f74SJames Wright    'linkify',
126*965d9f74SJames Wright    'colon_fence',
127*965d9f74SJames Wright]
128*965d9f74SJames Wright
129*965d9f74SJames Wrightmyst_heading_anchors = 2
130*965d9f74SJames Wright# Note: The config value `myst_url_schemes' defaults to type `list'
131*965d9f74SJames Wrightmyst_url_schemes = ['http', 'https', 'mailto']
132*965d9f74SJames Wright
133*965d9f74SJames Wright# -- Options for HTML output ----------------------------------------------
134*965d9f74SJames Wright
135*965d9f74SJames Wright# The theme to use for HTML and HTML Help pages.  See the documentation for
136*965d9f74SJames Wright# a list of builtin themes.
137*965d9f74SJames Wrighthtml_theme = 'furo'
138*965d9f74SJames Wright
139*965d9f74SJames Wright# Project logo
140*965d9f74SJames Wright# html_logo = 'doc/img/logo.png'
141*965d9f74SJames Wright
142*965d9f74SJames Wright# Project favicon
143*965d9f74SJames Wright# html_favicon = 'doc/img/logo.ico'
144*965d9f74SJames Wright
145*965d9f74SJames Wright# Theme options are theme-specific and customize the look and feel of a theme
146*965d9f74SJames Wright# further.  For a list of options available for each theme, see the
147*965d9f74SJames Wright# documentation.
148*965d9f74SJames Wright#
149*965d9f74SJames Wright# html_theme_options = {}
150*965d9f74SJames Wright
151*965d9f74SJames Wright# Add any paths that contain custom static files (such as style sheets) here,
152*965d9f74SJames Wright# relative to this directory. They are copied after the builtin static files,
153*965d9f74SJames Wright# so a file named "default.css" will overwrite the builtin "default.css".
154*965d9f74SJames Wrighthtml_static_path = ['doc/css']
155*965d9f74SJames Wright
156*965d9f74SJames Wright# hoverxref options
157*965d9f74SJames Wrighthoverxref_auto_ref = True
158*965d9f74SJames Wrighthoverxref_mathjax = True
159*965d9f74SJames Wrighthoverxref_role_types = {
160*965d9f74SJames Wright    'ref': 'modal',
161*965d9f74SJames Wright}
162*965d9f74SJames Wright
163*965d9f74SJames Wrightlatex_macros = r"""
164*965d9f74SJames Wright\def \diff {\operatorname{d}\!}
165*965d9f74SJames Wright\def \tcolon {\!:\!}
166*965d9f74SJames Wright\def \trace {\operatorname{trace}}
167*965d9f74SJames Wright\def \sign {\operatorname{sign}}
168*965d9f74SJames Wright"""
169*965d9f74SJames Wright
170*965d9f74SJames Wright# Translate LaTeX macros to KaTeX and add to options for HTML builder
171*965d9f74SJames Wrightkatex_macros = katex.latex_defs_to_katex_macros(latex_macros)
172*965d9f74SJames Wrightkatex_options = 'macros: {' + katex_macros + '}'
173*965d9f74SJames Wright
174*965d9f74SJames Wright# -- Options for HTMLHelp output ------------------------------------------
175*965d9f74SJames Wright
176*965d9f74SJames Wright# Output file base name for HTML help builder.
177*965d9f74SJames Wrighthtmlhelp_basename = 'HONEEdoc'
178*965d9f74SJames Wright
179*965d9f74SJames Wright
180*965d9f74SJames Wright# -- Options for LaTeX output ---------------------------------------------
181*965d9f74SJames Wright
182*965d9f74SJames Wrightlatex_engine = 'lualatex'
183*965d9f74SJames Wright
184*965d9f74SJames Wrightlatex_elements = {
185*965d9f74SJames Wright    # The paper size ('letterpaper' or 'a4paper').
186*965d9f74SJames Wright    #
187*965d9f74SJames Wright    # 'papersize': 'letterpaper',
188*965d9f74SJames Wright
189*965d9f74SJames Wright    # The font size ('10pt', '11pt' or '12pt').
190*965d9f74SJames Wright    #
191*965d9f74SJames Wright    # 'pointsize': '10pt',
192*965d9f74SJames Wright
193*965d9f74SJames Wright    # Additional stuff for the LaTeX preamble.
194*965d9f74SJames Wright    #
195*965d9f74SJames Wright    'preamble': r"""
196*965d9f74SJames Wright\usepackage{amscd}
197*965d9f74SJames Wright\newcommand\bm[1]{\symbf{#1}}
198*965d9f74SJames Wright""" + latex_macros,
199*965d9f74SJames Wright
200*965d9f74SJames Wright    # Latex figure (float) alignment
201*965d9f74SJames Wright    #
202*965d9f74SJames Wright    # 'figure_align': 'htbp',
203*965d9f74SJames Wright    'fontpkg': r"""
204*965d9f74SJames Wright\usepackage[math-style=ISO,bold-style=ISO]{unicode-math}
205*965d9f74SJames Wright\setmainfont{TeX Gyre Pagella}
206*965d9f74SJames Wright\setmathfont{TeX Gyre Pagella Math}
207*965d9f74SJames Wright\setsansfont{DejaVu Sans}
208*965d9f74SJames Wright\setmonofont{DejaVu Sans Mono}
209*965d9f74SJames Wright""",
210*965d9f74SJames Wright}
211*965d9f74SJames Wright
212*965d9f74SJames Wright# latex_logo = 'doc/img/logo.jpg'
213*965d9f74SJames Wright
214*965d9f74SJames Wright# latexauthorslist = r' \and '.join(authorlist)
215*965d9f74SJames Wrightlatexauthorslist = ''
216*965d9f74SJames Wright
217*965d9f74SJames Wright# Grouping the document tree into LaTeX files. List of tuples
218*965d9f74SJames Wright# (source start file, target name, title,
219*965d9f74SJames Wright#  author, documentclass [howto, manual, or own class]).
220*965d9f74SJames Wrightlatex_documents = [
221*965d9f74SJames Wright    (master_doc, 'honee.tex', 'HONEE User Manual', latexauthorslist, 'howto'),
222*965d9f74SJames Wright]
223*965d9f74SJames Wright
224*965d9f74SJames Wright# -- Options for manual page output ---------------------------------------
225*965d9f74SJames Wright
226*965d9f74SJames Wright# One entry per manual page. List of tuples
227*965d9f74SJames Wright# (source start file, name, description, authors, manual section).
228*965d9f74SJames Wrightman_pages = [
229*965d9f74SJames Wright    (master_doc, 'honee', 'HONEE User Manual', [author], 1)
230*965d9f74SJames Wright]
231*965d9f74SJames Wright
232*965d9f74SJames Wright# -- Options for Texinfo output -------------------------------------------
233*965d9f74SJames Wright
234*965d9f74SJames Wright# Grouping the document tree into Texinfo files. List of tuples
235*965d9f74SJames Wright# (source start file, target name, title, author,
236*965d9f74SJames Wright#  dir menu entry, description, category)
237*965d9f74SJames Wrighttexinfo_documents = [
238*965d9f74SJames Wright    (master_doc, 'honee', 'HONEE User Manual', latexauthorslist, 'HONEE', 'High-Order Navier-stokes Equation Evaluator'),
239*965d9f74SJames Wright]
240*965d9f74SJames Wright
241*965d9f74SJames Wright# -- Options for Epub output ----------------------------------------------
242*965d9f74SJames Wright
243*965d9f74SJames Wright# Bibliographic Dublin Core info.
244*965d9f74SJames Wrightepub_title = project
245*965d9f74SJames Wrightepub_author = author
246*965d9f74SJames Wrightepub_publisher = author
247*965d9f74SJames Wrightepub_copyright = copyright
248*965d9f74SJames Wright
249*965d9f74SJames Wright# The unique identifier of the text. This can be a ISBN number
250*965d9f74SJames Wright# or the project homepage.
251*965d9f74SJames Wright#
252*965d9f74SJames Wright# epub_identifier = ''
253*965d9f74SJames Wright
254*965d9f74SJames Wright# A unique identification for the text.
255*965d9f74SJames Wright#
256*965d9f74SJames Wright# epub_uid = ''
257*965d9f74SJames Wright
258*965d9f74SJames Wright# A list of files that should not be packed into the epub file.
259*965d9f74SJames Wrightepub_exclude_files = ['search.html']
260*965d9f74SJames Wright
261*965d9f74SJames Wright
262*965d9f74SJames Wright# Example configuration for intersphinx: refer to the Python standard library.
263*965d9f74SJames Wrightintersphinx_mapping = {
264*965d9f74SJames Wright    'python': ('https://docs.python.org/3', None),
265*965d9f74SJames Wright    'numpy': ('https://numpy.org/devdocs', None),
266*965d9f74SJames Wright}
267*965d9f74SJames Wright
268*965d9f74SJames Wright
269*965d9f74SJames Wright# -- Options for breathe --------------------------------------------------
270*965d9f74SJames Wrightbreathe_projects = {'HONEE': 'xml'}
271*965d9f74SJames Wrightbreathe_default_project = 'HONEE'
272*965d9f74SJames Wrightbreathe_build_directory = 'doc/build/breathe'
273*965d9f74SJames Wrightbreathe_domain_by_extension = {'c': 'c', 'h': 'c', 'cpp': 'cpp', 'hpp': 'cpp'}
274*965d9f74SJames Wrightbreathe_show_define_initializer = True
275