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


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:34:03