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