wrap/pybind11/docs/conf.py
Go to the documentation of this file.
1 #!/usr/bin/env python3
2 #
3 # pybind11 documentation build configuration file, created by
4 # sphinx-quickstart on Sun Oct 11 19:23:48 2015.
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 from __future__ import annotations
15 
16 import os
17 import re
18 import subprocess
19 import sys
20 from pathlib import Path
21 
22 DIR = Path(__file__).parent.resolve()
23 
24 # If extensions (or modules to document with autodoc) are in another directory,
25 # add these directories to sys.path here. If the directory is relative to the
26 # documentation root, use os.path.abspath to make it absolute, like shown here.
27 # sys.path.insert(0, os.path.abspath('.'))
28 
29 # -- General configuration ------------------------------------------------
30 
31 # If your documentation needs a minimal Sphinx version, state it here.
32 # needs_sphinx = '1.0'
33 
34 # Add any Sphinx extension module names here, as strings. They can be
35 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
36 # ones.
37 extensions = [
38  "breathe",
39  "sphinx_copybutton",
40  "sphinxcontrib.rsvgconverter",
41  "sphinxcontrib.moderncmakedomain",
42 ]
43 
44 breathe_projects = {"pybind11": ".build/doxygenxml/"}
45 breathe_default_project = "pybind11"
46 breathe_domain_by_extension = {"h": "cpp"}
47 
48 # Add any paths that contain templates here, relative to this directory.
49 templates_path = [".templates"]
50 
51 # The suffix(es) of source filenames.
52 # You can specify multiple suffix as a list of string:
53 # source_suffix = ['.rst', '.md']
54 source_suffix = ".rst"
55 
56 # The encoding of source files.
57 # source_encoding = 'utf-8-sig'
58 
59 # The master toctree document.
60 master_doc = "index"
61 
62 # General information about the project.
63 project = "pybind11"
64 copyright = "2017, Wenzel Jakob"
65 author = "Wenzel Jakob"
66 
67 # The version info for the project you're documenting, acts as replacement for
68 # |version| and |release|, also used in various other places throughout the
69 # built documents.
70 
71 # Read the listed version
72 with open("../pybind11/_version.py") as f:
73  code = compile(f.read(), "../pybind11/_version.py", "exec")
74 loc = {}
75 exec(code, loc)
76 
77 # The full version, including alpha/beta/rc tags.
78 version = loc["__version__"]
79 
80 # The language for content autogenerated by Sphinx. Refer to documentation
81 # for a list of supported languages.
82 #
83 # This is also used if you do content translation via gettext catalogs.
84 # Usually you set "language" from the command line for these cases.
85 language = "en"
86 
87 # There are two options for replacing |today|: either, you set today to some
88 # non-false value, then it is used:
89 # today = ''
90 # Else, today_fmt is used as the format for a strftime call.
91 # today_fmt = '%B %d, %Y'
92 
93 # List of patterns, relative to source directory, that match files and
94 # directories to ignore when looking for source files.
95 exclude_patterns = [".build", "release.rst"]
96 
97 # The reST default role (used for this markup: `text`) to use for all
98 # documents.
99 default_role = "any"
100 
101 # If true, '()' will be appended to :func: etc. cross-reference text.
102 # add_function_parentheses = True
103 
104 # If true, the current module name will be prepended to all description
105 # unit titles (such as .. function::).
106 # add_module_names = True
107 
108 # If true, sectionauthor and moduleauthor directives will be shown in the
109 # output. They are ignored by default.
110 # show_authors = False
111 
112 # The name of the Pygments (syntax highlighting) style to use.
113 # pygments_style = 'monokai'
114 
115 # A list of ignored prefixes for module index sorting.
116 # modindex_common_prefix = []
117 
118 # If true, keep warnings as "system message" paragraphs in the built documents.
119 # keep_warnings = False
120 
121 # If true, `todo` and `todoList` produce output, else they produce nothing.
122 todo_include_todos = False
123 
124 
125 # -- Options for HTML output ----------------------------------------------
126 
127 # The theme to use for HTML and HTML Help pages. See the documentation for
128 # a list of builtin themes.
129 
130 html_theme = "furo"
131 
132 # Theme options are theme-specific and customize the look and feel of a theme
133 # further. For a list of options available for each theme, see the
134 # documentation.
135 # html_theme_options = {}
136 
137 # Add any paths that contain custom themes here, relative to this directory.
138 # html_theme_path = []
139 
140 # The name for this set of Sphinx documents. If None, it defaults to
141 # "<project> v<version> documentation".
142 # html_title = None
143 
144 # A shorter title for the navigation bar. Default is the same as html_title.
145 # html_short_title = None
146 
147 # The name of an image file (relative to this directory) to place at the top
148 # of the sidebar.
149 # html_logo = None
150 
151 # The name of an image file (within the static path) to use as favicon of the
152 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
153 # pixels large.
154 # html_favicon = None
155 
156 # Add any paths that contain custom static files (such as style sheets) here,
157 # relative to this directory. They are copied after the builtin static files,
158 # so a file named "default.css" will overwrite the builtin "default.css".
159 html_static_path = ["_static"]
160 
161 html_css_files = [
162  "css/custom.css",
163 ]
164 
165 # Add any extra paths that contain custom files (such as robots.txt or
166 # .htaccess) here, relative to this directory. These files are copied
167 # directly to the root of the documentation.
168 # html_extra_path = []
169 
170 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
171 # using the given strftime format.
172 # html_last_updated_fmt = '%b %d, %Y'
173 
174 # If true, SmartyPants will be used to convert quotes and dashes to
175 # typographically correct entities.
176 # html_use_smartypants = True
177 
178 # Custom sidebar templates, maps document names to template names.
179 # html_sidebars = {}
180 
181 # Additional templates that should be rendered to pages, maps page names to
182 # template names.
183 # html_additional_pages = {}
184 
185 # If false, no module index is generated.
186 # html_domain_indices = True
187 
188 # If false, no index is generated.
189 # html_use_index = True
190 
191 # If true, the index is split into individual pages for each letter.
192 # html_split_index = False
193 
194 # If true, links to the reST sources are added to the pages.
195 # html_show_sourcelink = True
196 
197 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
198 # html_show_sphinx = True
199 
200 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
201 # html_show_copyright = True
202 
203 # If true, an OpenSearch description file will be output, and all pages will
204 # contain a <link> tag referring to it. The value of this option must be the
205 # base URL from which the finished HTML is served.
206 # html_use_opensearch = ''
207 
208 # This is the file name suffix for HTML files (e.g. ".xhtml").
209 # html_file_suffix = None
210 
211 # Language to be used for generating the HTML full-text search index.
212 # Sphinx supports the following languages:
213 # 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
214 # 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
215 # html_search_language = 'en'
216 
217 # A dictionary with options for the search language support, empty by default.
218 # Now only 'ja' uses this config value
219 # html_search_options = {'type': 'default'}
220 
221 # The name of a javascript file (relative to the configuration directory) that
222 # implements a search results scorer. If empty, the default will be used.
223 # html_search_scorer = 'scorer.js'
224 
225 # Output file base name for HTML help builder.
226 htmlhelp_basename = "pybind11doc"
227 
228 # -- Options for LaTeX output ---------------------------------------------
229 
230 latex_engine = "pdflatex"
231 
232 latex_elements = {
233  # The paper size ('letterpaper' or 'a4paper').
234  # 'papersize': 'letterpaper',
235  #
236  # The font size ('10pt', '11pt' or '12pt').
237  # 'pointsize': '10pt',
238  #
239  # Additional stuff for the LaTeX preamble.
240  # remove blank pages (between the title page and the TOC, etc.)
241  "classoptions": ",openany,oneside",
242  "preamble": r"""
243 \usepackage{fontawesome}
244 \usepackage{textgreek}
245 \DeclareUnicodeCharacter{00A0}{}
246 \DeclareUnicodeCharacter{2194}{\faArrowsH}
247 \DeclareUnicodeCharacter{1F382}{\faBirthdayCake}
248 \DeclareUnicodeCharacter{1F355}{\faAdjust}
249 \DeclareUnicodeCharacter{0301}{'}
250 \DeclareUnicodeCharacter{03C0}{\textpi}
251 
252 """,
253  # Latex figure (float) alignment
254  # 'figure_align': 'htbp',
255 }
256 
257 # Grouping the document tree into LaTeX files. List of tuples
258 # (source start file, target name, title,
259 # author, documentclass [howto, manual, or own class]).
260 latex_documents = [
261  (master_doc, "pybind11.tex", "pybind11 Documentation", "Wenzel Jakob", "manual"),
262 ]
263 
264 # The name of an image file (relative to this directory) to place at the top of
265 # the title page.
266 # latex_logo = 'pybind11-logo.png'
267 
268 # For "manual" documents, if this is true, then toplevel headings are parts,
269 # not chapters.
270 # latex_use_parts = False
271 
272 # If true, show page references after internal links.
273 # latex_show_pagerefs = False
274 
275 # If true, show URL addresses after external links.
276 # latex_show_urls = False
277 
278 # Documents to append as an appendix to all manuals.
279 # latex_appendices = []
280 
281 # If false, no module index is generated.
282 # latex_domain_indices = True
283 
284 
285 # -- Options for manual page output ---------------------------------------
286 
287 # One entry per manual page. List of tuples
288 # (source start file, name, description, authors, manual section).
289 man_pages = [(master_doc, "pybind11", "pybind11 Documentation", [author], 1)]
290 
291 # If true, show URL addresses after external links.
292 # man_show_urls = False
293 
294 
295 # -- Options for Texinfo output -------------------------------------------
296 
297 # Grouping the document tree into Texinfo files. List of tuples
298 # (source start file, target name, title, author,
299 # dir menu entry, description, category)
300 texinfo_documents = [
301  (
302  master_doc,
303  "pybind11",
304  "pybind11 Documentation",
305  author,
306  "pybind11",
307  "One line description of project.",
308  "Miscellaneous",
309  ),
310 ]
311 
312 # Documents to append as an appendix to all manuals.
313 # texinfo_appendices = []
314 
315 # If false, no module index is generated.
316 # texinfo_domain_indices = True
317 
318 # How to display URL addresses: 'footnote', 'no', or 'inline'.
319 # texinfo_show_urls = 'footnote'
320 
321 # If true, do not generate a @detailmenu in the "Top" node's menu.
322 # texinfo_no_detailmenu = False
323 
324 primary_domain = "cpp"
325 highlight_language = "cpp"
326 
327 
329  build_dir = os.path.join(app.confdir, ".build")
330  if not os.path.exists(build_dir):
331  os.mkdir(build_dir)
332 
333  try:
334  subprocess.call(["doxygen", "--version"])
335  retcode = subprocess.call(["doxygen"], cwd=app.confdir)
336  if retcode < 0:
337  sys.stderr.write(f"doxygen error code: {-retcode}\n")
338  except OSError as e:
339  sys.stderr.write(f"doxygen execution failed: {e}\n")
340 
341 
342 def prepare(app):
343  with open(DIR.parent / "README.rst") as f:
344  contents = f.read()
345 
346  if app.builder.name == "latex":
347  # Remove badges and stuff from start
348  contents = contents[contents.find(r".. start") :]
349 
350  # Filter out section titles for index.rst for LaTeX
351  contents = re.sub(r"^(.*)\n[-~]{3,}$", r"**\1**", contents, flags=re.MULTILINE)
352 
353  with open(DIR / "readme.rst", "w") as f:
354  f.write(contents)
355 
356 
357 def clean_up(app, exception): # noqa: ARG001
358  (DIR / "readme.rst").unlink()
359 
360 
361 def setup(app):
362  # Add hook for building doxygen xml when needed
363  app.connect("builder-inited", generate_doxygen_xml)
364 
365  # Copy the readme in
366  app.connect("builder-inited", prepare)
367 
368  # Clean up the generated readme
369  app.connect("build-finished", clean_up)
conf.clean_up
def clean_up(app, exception)
Definition: wrap/pybind11/docs/conf.py:357
exec
void exec(const str &expr, object global=globals(), object local=object())
Definition: eval.h:88
conf.prepare
def prepare(app)
Definition: wrap/pybind11/docs/conf.py:342
conf.generate_doxygen_xml
def generate_doxygen_xml(app)
Definition: wrap/pybind11/docs/conf.py:328
conf.setup
def setup(app)
Definition: wrap/pybind11/docs/conf.py:361


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:01