xref: /honee/conf.py (revision c9f376050d3861e44a3522dda28dab81f9a3076c)
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\def \Pe {\mathrm{Pe}}
168\def \CFL {\mathrm{CFL}}
169\def \gbar #1{\overline{g}_{#1}}
170\def \mean {\braket}
171\def \dt {\Delta t}
172"""
173
174# Translate LaTeX macros to KaTeX and add to options for HTML builder
175katex_macros = katex.latex_defs_to_katex_macros(latex_macros)
176katex_options = 'macros: {' + katex_macros + '}'
177
178# -- Options for HTMLHelp output ------------------------------------------
179
180# Output file base name for HTML help builder.
181htmlhelp_basename = 'HONEEdoc'
182
183
184# -- Options for LaTeX output ---------------------------------------------
185
186latex_engine = 'lualatex'
187
188latex_elements = {
189    # The paper size ('letterpaper' or 'a4paper').
190    #
191    # 'papersize': 'letterpaper',
192
193    # The font size ('10pt', '11pt' or '12pt').
194    #
195    # 'pointsize': '10pt',
196
197    # Additional stuff for the LaTeX preamble.
198    #
199    'preamble': r"""
200\usepackage{amscd}
201\newcommand\bm[1]{\symbf{#1}}
202""" + latex_macros,
203
204    # Latex figure (float) alignment
205    #
206    # 'figure_align': 'htbp',
207    'fontpkg': r"""
208\usepackage[math-style=ISO,bold-style=ISO]{unicode-math}
209\setmainfont{TeX Gyre Pagella}
210\setmathfont{TeX Gyre Pagella Math}
211\setsansfont{DejaVu Sans}
212\setmonofont{DejaVu Sans Mono}
213""",
214}
215
216# latex_logo = 'doc/img/logo.jpg'
217
218latexauthorslist = r' \and '.join(authorlist)
219
220# Grouping the document tree into LaTeX files. List of tuples
221# (source start file, target name, title,
222#  author, documentclass [howto, manual, or own class]).
223latex_documents = [
224    (master_doc, 'honee.tex', 'HONEE User Manual', latexauthorslist, 'howto'),
225]
226
227# -- Options for manual page output ---------------------------------------
228
229# One entry per manual page. List of tuples
230# (source start file, name, description, authors, manual section).
231man_pages = [
232    (master_doc, 'honee', 'HONEE User Manual', [author], 1)
233]
234
235# -- Options for Texinfo output -------------------------------------------
236
237# Grouping the document tree into Texinfo files. List of tuples
238# (source start file, target name, title, author,
239#  dir menu entry, description, category)
240texinfo_documents = [
241    (master_doc, 'honee', 'HONEE User Manual', latexauthorslist, 'HONEE', 'High-Order Navier-stokes Equation Evaluator'),
242]
243
244# -- Options for Epub output ----------------------------------------------
245
246# Bibliographic Dublin Core info.
247epub_title = project
248epub_author = author
249epub_publisher = author
250epub_copyright = copyright
251
252# The unique identifier of the text. This can be a ISBN number
253# or the project homepage.
254#
255# epub_identifier = ''
256
257# A unique identification for the text.
258#
259# epub_uid = ''
260
261# A list of files that should not be packed into the epub file.
262epub_exclude_files = ['search.html']
263
264
265# Example configuration for intersphinx: refer to the Python standard library.
266intersphinx_mapping = {
267    'python': ('https://docs.python.org/3', None),
268    'numpy': ('https://numpy.org/devdocs', None),
269}
270
271
272# -- Options for breathe --------------------------------------------------
273breathe_projects = {'HONEE': 'xml'}
274breathe_default_project = 'HONEE'
275breathe_build_directory = 'doc/build/breathe'
276breathe_domain_by_extension = {'c': 'c', 'h': 'c', 'cpp': 'cpp', 'hpp': 'cpp'}
277breathe_show_define_initializer = True
278