xref: /honee/conf.py (revision 965d9f743f86785935177ec2ff1624a7b09e04f8)
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'
73# with open(Path('AUTHORS')) as f:
74#     authorlist = f.readlines()
75# author = ', '.join(authorlist)
76author = ''
77
78# # The version info for the project you're documenting, acts as replacement for
79# # |version| and |release|, also used in various other places throughout the
80# # built documents.
81# #
82# # The short X.Y version.
83# with open(Path('ratel.pc.template')) as f:
84#     pkgconf_version = 'unknown'
85#     for line in f:
86#         if line.startswith('Version:'):
87#             pkgconf_version = line.partition(': ')[2]
88#             break
89# version = pkgconf_version
90# # The full version, including alpha/beta/rc tags.
91# release = pkgconf_version
92
93# The language for content autogenerated by Sphinx. Refer to documentation
94# for a list of supported languages.
95#
96# This is also used if you do content translation via gettext catalogs.
97# Usually you set "language" from the command line for these cases.
98language = 'en'
99
100# List of patterns, relative to source directory, that match files and
101# directories to ignore when looking for source files.
102# This patterns also effect to html_static_path and html_extra_path
103exclude_patterns = [
104    '.gitlab',
105    'VENV*',
106    'tests/junit-xml/*',
107    'tests/README.md',
108    'tests/createPyTorchModel/README.md',
109    'RELEASING.md',
110]
111
112# The name of the Pygments (syntax highlighting) style to use.
113pygments_style = 'sphinx'
114
115# If true, `todo` and `todoList` produce output, else they produce nothing.
116todo_include_todos = True
117
118# sphinxcontrib-bibtex 2.0 requires listing all bibtex files here
119bibtex_bibfiles = ['doc/references.bib']
120
121myst_enable_extensions = [
122    'deflist',
123    'dollarmath',
124    'html_image',
125    'linkify',
126    'colon_fence',
127]
128
129myst_heading_anchors = 2
130# Note: The config value `myst_url_schemes' defaults to type `list'
131myst_url_schemes = ['http', 'https', 'mailto']
132
133# -- Options for HTML output ----------------------------------------------
134
135# The theme to use for HTML and HTML Help pages.  See the documentation for
136# a list of builtin themes.
137html_theme = 'furo'
138
139# Project logo
140# html_logo = 'doc/img/logo.png'
141
142# Project favicon
143# html_favicon = 'doc/img/logo.ico'
144
145# Theme options are theme-specific and customize the look and feel of a theme
146# further.  For a list of options available for each theme, see the
147# documentation.
148#
149# html_theme_options = {}
150
151# Add any paths that contain custom static files (such as style sheets) here,
152# relative to this directory. They are copied after the builtin static files,
153# so a file named "default.css" will overwrite the builtin "default.css".
154html_static_path = ['doc/css']
155
156# hoverxref options
157hoverxref_auto_ref = True
158hoverxref_mathjax = True
159hoverxref_role_types = {
160    'ref': 'modal',
161}
162
163latex_macros = r"""
164\def \diff {\operatorname{d}\!}
165\def \tcolon {\!:\!}
166\def \trace {\operatorname{trace}}
167\def \sign {\operatorname{sign}}
168"""
169
170# Translate LaTeX macros to KaTeX and add to options for HTML builder
171katex_macros = katex.latex_defs_to_katex_macros(latex_macros)
172katex_options = 'macros: {' + katex_macros + '}'
173
174# -- Options for HTMLHelp output ------------------------------------------
175
176# Output file base name for HTML help builder.
177htmlhelp_basename = 'HONEEdoc'
178
179
180# -- Options for LaTeX output ---------------------------------------------
181
182latex_engine = 'lualatex'
183
184latex_elements = {
185    # The paper size ('letterpaper' or 'a4paper').
186    #
187    # 'papersize': 'letterpaper',
188
189    # The font size ('10pt', '11pt' or '12pt').
190    #
191    # 'pointsize': '10pt',
192
193    # Additional stuff for the LaTeX preamble.
194    #
195    'preamble': r"""
196\usepackage{amscd}
197\newcommand\bm[1]{\symbf{#1}}
198""" + latex_macros,
199
200    # Latex figure (float) alignment
201    #
202    # 'figure_align': 'htbp',
203    'fontpkg': r"""
204\usepackage[math-style=ISO,bold-style=ISO]{unicode-math}
205\setmainfont{TeX Gyre Pagella}
206\setmathfont{TeX Gyre Pagella Math}
207\setsansfont{DejaVu Sans}
208\setmonofont{DejaVu Sans Mono}
209""",
210}
211
212# latex_logo = 'doc/img/logo.jpg'
213
214# latexauthorslist = r' \and '.join(authorlist)
215latexauthorslist = ''
216
217# Grouping the document tree into LaTeX files. List of tuples
218# (source start file, target name, title,
219#  author, documentclass [howto, manual, or own class]).
220latex_documents = [
221    (master_doc, 'honee.tex', 'HONEE User Manual', latexauthorslist, 'howto'),
222]
223
224# -- Options for manual page output ---------------------------------------
225
226# One entry per manual page. List of tuples
227# (source start file, name, description, authors, manual section).
228man_pages = [
229    (master_doc, 'honee', 'HONEE User Manual', [author], 1)
230]
231
232# -- Options for Texinfo output -------------------------------------------
233
234# Grouping the document tree into Texinfo files. List of tuples
235# (source start file, target name, title, author,
236#  dir menu entry, description, category)
237texinfo_documents = [
238    (master_doc, 'honee', 'HONEE User Manual', latexauthorslist, 'HONEE', 'High-Order Navier-stokes Equation Evaluator'),
239]
240
241# -- Options for Epub output ----------------------------------------------
242
243# Bibliographic Dublin Core info.
244epub_title = project
245epub_author = author
246epub_publisher = author
247epub_copyright = copyright
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.
259epub_exclude_files = ['search.html']
260
261
262# Example configuration for intersphinx: refer to the Python standard library.
263intersphinx_mapping = {
264    'python': ('https://docs.python.org/3', None),
265    'numpy': ('https://numpy.org/devdocs', None),
266}
267
268
269# -- Options for breathe --------------------------------------------------
270breathe_projects = {'HONEE': 'xml'}
271breathe_default_project = 'HONEE'
272breathe_build_directory = 'doc/build/breathe'
273breathe_domain_by_extension = {'c': 'c', 'h': 'c', 'cpp': 'cpp', 'hpp': 'cpp'}
274breathe_show_define_initializer = True
275