Debian Codegraph @

docs/source/conf.py

raw
1 # -*- coding: utf-8 -*-
2 #
3 # sample documentation build configuration file, created by
4 # sphinx-quickstart on Mon Apr 16 21:22:43 2012.
5 #
6 # This file is execfile()d with the current directory set to its containing dir.
7 #
8 # Not that not all possible configuration values are present in this
9 # autogenerated file.
10 #
11 # All configuration values have a default; values that are commented out
12 # serve to show the default.
13
14 import os
15 import sys
16
17 import sphinx_rtd_theme
18
19 # -- Support building doc without install --------------------------------------
20
21 # If extensions (or modules to document with autodoc) are in another directory,
22 # add these directories to sys.path here. If the directory is relative to the
23 # documentation root, use os.path.abspath to make it absolute, like shown here.
24 # sys.path.insert(0, os.path.abspath('.'))
25
26 # Get the project root dir, which is the parent parent dir of this
27 cwd = os.getcwd()
28 project_root = os.path.dirname(os.path.dirname(cwd))
29
30 # Insert the project root dir as the first element in the PYTHONPATH.
31 # This lets us ensure that the source package is imported, and that its
32 # version is used.
33 sys.path.insert(0, os.path.join(project_root, "src"))
34
35 import hdmf
36
37 # -- Autodoc configuration -----------------------------------------------------
38
39 autoclass_content = "both"
40 autodoc_docstring_signature = True
41 autodoc_member_order = "bysource"
42
43 # -- General configuration -----------------------------------------------------
44
45 # If your documentation needs a minimal Sphinx version, state it here.
46 # needs_sphinx = '1.0'
47
48 # Add any Sphinx extension module names here, as strings. They can be extensions
49 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
50 extensions = [
51 "sphinx.ext.autodoc",
52 "sphinx.ext.napoleon",
53 "sphinx.ext.intersphinx",
54 "sphinx_gallery.gen_gallery",
55 "sphinx_copybutton",
56 "sphinxcontrib.jquery", # can be removed as soon as the theme no longer depends on jQuery
57 ]
58
59 from sphinx_gallery.sorting import ExplicitOrder
60
61 sphinx_gallery_conf = {
62 # path to your examples scripts
63 "examples_dirs": ["../gallery"],
64 # path where to save gallery generated examples
65 "gallery_dirs": ["tutorials"],
66 # 'subsection_order': ExplicitOrder(['../gallery/section1', '../gallery/section2']),
67 "backreferences_dir": "gen_modules/backreferences",
68 "min_reported_time": 5,
69 "remove_config_comments": True,
70 }
71
72 intersphinx_mapping = {
73 "python": ("https://docs.python.org/3.12", None),
74 "numpy": ("https://numpy.org/doc/stable/", None),
75 "scipy": ("https://docs.scipy.org/doc/scipy/", None),
76 "matplotlib": ("https://matplotlib.org/stable/", None),
77 "h5py": ("https://docs.h5py.org/en/latest/", None),
78 "pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
79 "zarr": ("https://zarr.readthedocs.io/en/stable/", None),
80 }
81
82 # these links cannot be checked in github actions
83 linkcheck_ignore = [
84 "https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key",
85 "https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request",
86 ]
87
88 nitpicky = True
89 nitpick_ignore = [('py:class', 'Intracomm'),
90 ('py:class', 'h5py.RegionReference'),
91 ('py:class', 'h5py._hl.dataset.Dataset'),
92 ('py:class', 'function'),
93 ('py:class', 'unittest.case.TestCase'),
94 ]
95
96 suppress_warnings = ["config.cache"]
97
98 # Add any paths that contain templates here, relative to this directory.
99 templates_path = ["_templates"]
100
101 # The suffix of source filenames.
102 source_suffix = ".rst"
103
104 # The encoding of source files.
105 # source_encoding = 'utf-8-sig'
106
107 # The master toctree document.
108 master_doc = "source/index"
109 master_doc = "index"
110
111 # General information about the project.
112 project = "HDMF"
113 copyright = "2017-2024, Hierarchical Data Modeling Framework"
114
115 # The version info for the project you're documenting, acts as replacement for
116 # |version| and |release|, also used in various other places throughout the
117 # built documents.
118 #
119 # The short X.Y version.
120 version = hdmf.__version__
121 # The full version, including alpha/beta/rc tags.
122 release = hdmf.__version__
123
124 # The language for content autogenerated by Sphinx. Refer to documentation
125 # for a list of supported languages.
126 # language = None
127
128 # There are two options for replacing |today|: either, you set today to some
129 # non-false value, then it is used:
130 # today = ''
131 # Else, today_fmt is used as the format for a strftime call.
132 # today_fmt = '%B %d, %Y'
133
134 # List of patterns, relative to source directory, that match files and
135 # directories to ignore when looking for source files.
136 exclude_patterns = ["_build", "test.py"]
137
138 # The reST default role (used for this markup: `text`) to use for all documents.
139 # default_role = None
140
141 # If true, '()' will be appended to :func: etc. cross-reference text.
142 add_function_parentheses = False
143
144 # If true, the current module name will be prepended to all description
145 # unit titles (such as .. function::).
146 # add_module_names = True
147
148 # If true, sectionauthor and moduleauthor directives will be shown in the
149 # output. They are ignored by default.
150 # show_authors = False
151
152 # The name of the Pygments (syntax highlighting) style to use.
153 pygments_style = "sphinx"
154
155 # A list of ignored prefixes for module index sorting.
156 # modindex_common_prefix = []
157
158
159 # -- Options for HTML output ---------------------------------------------------
160
161 # The theme to use for HTML and HTML Help pages. See the documentation for
162 # a list of builtin themes.
163 # html_theme = 'default'
164 # html_theme = "sphinxdoc"
165 html_theme = "sphinx_rtd_theme"
166 html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
167
168 # Theme options are theme-specific and customize the look and feel of a theme
169 # further. For a list of options available for each theme, see the
170 # documentation.
171 # html_theme_options = {}
172
173 # Add any paths that contain custom themes here, relative to this directory.
174 # html_theme_path = []
175
176 # The name for this set of Sphinx documents. If None, it defaults to
177 # "<project> v<release> documentation".
178 # html_title = None
179
180 # A shorter title for the navigation bar. Default is the same as html_title.
181 # html_short_title = None
182
183 # The name of an image file (relative to this directory) to place at the top
184 # of the sidebar.
185 # html_logo = None
186 html_logo = "hdmf_logo.png"
187
188 # The name of an image file (within the static path) to use as favicon of the
189 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
190 # pixels large.
191 html_favicon = "hdmf_logo-180x180.png"
192
193 # Add any paths that contain custom static files (such as style sheets) here,
194 # relative to this directory. They are copied after the builtin static files,
195 # so a file named "default.css" will overwrite the builtin "default.css".
196 html_static_path = ["_static"]
197
198 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
199 # using the given strftime format.
200 # html_last_updated_fmt = '%b %d, %Y'
201
202 # If true, SmartyPants will be used to convert quotes and dashes to
203 # typographically correct entities.
204 # html_use_smartypants = True
205
206 # Custom sidebar templates, maps document names to template names.
207 # html_sidebars = {}
208
209 # Additional templates that should be rendered to pages, maps page names to
210 # template names.
211 # html_additional_pages = {}
212
213 # If false, no module index is generated.
214 # html_domain_indices = True
215
216 # If false, no index is generated.
217 # html_use_index = True
218
219 # If true, the index is split into individual pages for each letter.
220 # html_split_index = False
221
222 # If true, links to the reST sources are added to the pages.
223 # html_show_sourcelink = True
224
225 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
226 # html_show_sphinx = True
227
228 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
229 # html_show_copyright = True
230
231 # If true, an OpenSearch description file will be output, and all pages will
232 # contain a <link> tag referring to it. The value of this option must be the
233 # base URL from which the finished HTML is served.
234 # html_use_opensearch = ''
235
236 # This is the file name suffix for HTML files (e.g. ".xhtml").
237 # html_file_suffix = None
238
239 # Output file base name for HTML help builder.
240 htmlhelp_basename = "sampledoc"
241
242
243 # -- Options for LaTeX output --------------------------------------------------
244
245 latex_elements = {
246 # The paper size ('letterpaper' or 'a4paper').
247 # 'papersize': 'letterpaper',
248 # The font size ('10pt', '11pt' or '12pt').
249 # 'pointsize': '10pt',
250 # Additional stuff for the LaTeX preamble.
251 # 'print()reamble': '',
252 }
253
254 # Grouping the document tree into LaTeX files. List of tuples
255 # (source start file, target name, title, author, documentclass [howto/manual]).
256 # latex_documents = [
257 # ('index', 'sample.tex', u'sample Documentation',
258 # u'Kenneth Reitz', 'manual'),
259 # ]
260
261 # The name of an image file (relative to this directory) to place at the top of
262 # the title page.
263 latex_logo = "hdmf_logo.pdf"
264
265 # For "manual" documents, if this is true, then toplevel headings are parts,
266 # not chapters.
267 # latex_use_parts = False
268
269 # If true, show page references after internal links.
270 # latex_show_pagerefs = False
271
272 # If true, show URL addresses after external links.
273 # latex_show_urls = False
274
275 # Documents to append as an appendix to all manuals.
276 # latex_appendices = []
277
278 # If false, no module index is generated.
279 # latex_domain_indices = True
280
281
282 # -- Options for manual page output --------------------------------------------
283
284 # One entry per manual page. List of tuples
285 # (source start file, name, description, authors, manual section).
286 # man_pages = [
287 # ('index', 'sample', u'sample Documentation',
288 # [u'Kenneth Reitz'], 1)
289 # ]
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 # ('index', 'sample', u'sample Documentation',
302 # u'Kenneth Reitz', 'sample', 'One line description of project.',
303 # 'Miscellaneous'),
304 # ]
305
306 # Documents to append as an appendix to all manuals.
307 # texinfo_appendices = []
308
309 # If false, no module index is generated.
310 # texinfo_domain_indices = True
311
312 # How to display URL addresses: 'footnote', 'no', or 'inline'.
313 # texinfo_show_urls = 'footnote'
314
315
316 # -- sphinx extension ----------------------------------------------------
317
318 #
319 # see http://www.sphinx-doc.org/en/master/extdev/appapi.html
320 #
321
322
323 def run_apidoc(_):
324 import os
325 import sys
326
327 from sphinx.ext.apidoc import main as apidoc_main
328
329 out_dir = os.path.dirname(__file__)
330 src_dir = os.path.join(out_dir, "../../src")
331 sys.path.append(src_dir)
332 apidoc_main(["-f", "-e", "--no-toc", "-o", out_dir, src_dir])
333
334
335 from abc import abstractproperty
336
337
338 def skip(app, what, name, obj, skip, options):
339 if isinstance(obj, abstractproperty) or getattr(obj, "__isabstractmethod__", False):
340 return False
341 elif name == "__getitem__":
342 return False
343 return skip
344
345
346 def setup(app):
347 app.connect("builder-inited", run_apidoc)
348 app.add_css_file("theme_overrides.css")
349 app.connect("autodoc-skip-member", skip)