Debian Codegraph @

docs/conf.py

raw
1 # -*- coding: utf-8 -*-
2 #
3 # GraphQL-core 3 documentation build configuration file, created by
4 # sphinx-quickstart on Thu Jun 21 16:28:30 2018.
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('.'))
22
23 # -- General configuration ------------------------------------------------
24
25 # If your documentation needs a minimal Sphinx version, state it here.
26 #
27 # needs_sphinx = '1.0'
28
29 # Add any Sphinx extension module names here, as strings. They can be
30 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
31 # ones.
32 extensions = [
33 "sphinx.ext.autodoc",
34 ]
35
36 # Add any paths that contain templates here, relative to this directory.
37 templates_path = ["_templates"]
38
39 # The suffix(es) of source filenames.
40 # You can specify multiple suffix as a list of string:
41 #
42 # source_suffix = ['.rst', '.md']
43 source_suffix = ".rst"
44
45 # The encoding of source files.
46 #
47 # source_encoding = 'utf-8-sig'
48
49 # The master toctree document.
50 master_doc = "index"
51
52 # General information about the project.
53 project = "GraphQL-core 3"
54 copyright = "2026, Christoph Zwerschke"
55 author = "Christoph Zwerschke"
56
57 # The version info for the project you're documenting, acts as replacement for
58 # |version| and |release|, also used in various other places throughout the
59 # built documents.
60 #
61 # The short X.Y version.
62 # version = '3.2'
63 # The full version, including alpha/beta/rc tags.
64 version = release = "3.2.12"
65
66 # The language for content autogenerated by Sphinx. Refer to documentation
67 # for a list of supported languages.
68 #
69 # This is also used if you do content translation via gettext catalogs.
70 # Usually you set "language" from the command line for these cases.
71 language = "en"
72
73 # There are two options for replacing |today|: either, you set today to some
74 # non-false value, then it is used:
75 #
76 # today = ''
77 #
78 # Else, today_fmt is used as the format for a strftime call.
79 #
80 # today_fmt = '%B %d, %Y'
81
82 # List of patterns, relative to source directory, that match files and
83 # directories to ignore when looking for source files.
84 # This patterns also effect to html_static_path and html_extra_path
85 exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
86
87 # AutoDoc configuration
88 autoclass_content = "class"
89 autodoc_default_options = {
90 "members": True,
91 "inherited-members": True,
92 "undoc-members": True,
93 "show-inheritance": True,
94 }
95 autosummary_generate = True
96
97 autodoc_type_aliases = {
98 "AwaitableOrValue": "graphql.pyutils.AwaitableOrValue",
99 "FormattedSourceLocation": "graphql.language.FormattedSourceLocation",
100 "Middleware": "graphql.execution.Middleware",
101 "TypeMap": "graphql.schema.TypeMap",
102 }
103
104 # GraphQL-core top level modules with submodules that can be omitted.
105 # Sometimes autodoc cannot find classes since it is looking for the
106 # qualified form, but the documentation has the shorter form.
107 # We need to give autodoc a little help in this cases.
108 graphql_modules = {
109 "error": ["graphql_error"],
110 "execution": ["execute", "middleware"],
111 "language": [
112 "ast",
113 "directive_locations",
114 "location",
115 "source",
116 "token_kind",
117 "visitor",
118 ],
119 "pyutils": ["simple_pub_sub", "frozen_list", "path"],
120 "type": ["definition", "directives", "schema"],
121 "utilities": ["find_breaking_changes", "type_info"],
122 "validation": ["rules", "validation_context"],
123 }
124
125 # GraphQL-core classes that autodoc sometimes cannot find
126 # (e.g. where specified as string in type hints).
127 # We need to give autodoc a little help in this cases, too:
128 graphql_classes = {
129 "GraphQLAbstractType": "type",
130 "GraphQLObjectType": "type",
131 "GraphQLOutputType": "type",
132 "GraphQLTypeResolver": "type",
133 "Node": "language",
134 "Source": "language",
135 "SourceLocation": "language",
136 }
137
138 # ignore the following undocumented or internal references:
139 ignore_references = set(
140 """
141 GNT GT KT T VT
142 _asyncio.Future
143 asyncio.queues.Queue
144 enum.Enum
145 traceback
146 types.TracebackType
147 EnterLeaveVisitor
148 FormattedSourceLocation
149 GraphQLAbstractType
150 GraphQLErrorExtensions
151 GraphQLFormattedErrorExtensions
152 GraphQLOutputType
153 asyncio.events.AbstractEventLoop
154 graphql.execution.execute.CollectedErrors
155 graphql.execution.map_async_iterator.MapAsyncIterator
156 graphql.language.lexer.EscapeSequence
157 graphql.language.visitor.EnterLeaveVisitor
158 graphql.type.schema.InterfaceImplementations
159 graphql.validation.validation_context.VariableUsage
160 graphql.validation.rules.known_argument_names.KnownArgumentNamesOnDirectivesRule
161 graphql.validation.rules.provided_required_arguments.ProvidedRequiredArgumentsOnDirectivesRule
162 """.split()
163 )
164
165 ignore_references.update(__builtins__.keys())
166
167
168 def on_missing_reference(app, env, node, contnode):
169 """Fix or skip any missing references."""
170 if node.get("refdomain") != "py":
171 return None
172 target = node.get("reftarget")
173 if not target:
174 return None
175 if target in ignore_references or target.endswith("Kwargs"):
176 return contnode
177 typ = node.get("reftype")
178 name = target.rsplit(".", 1)[-1]
179 if name in ("GT", "GNT", "KT", "T", "VT"):
180 return contnode
181 if typ == "obj":
182 if target.startswith("typing."):
183 if name in ("Any", "Optional", "Union"):
184 return contnode
185 if typ != "class":
186 return None
187 if "." in target: # maybe too specific
188 base_module, target = target.split(".", 1)
189 if base_module == "graphql":
190 if "." not in target:
191 return None
192 base_module, target = target.split(".", 1)
193 if "." not in target:
194 return None
195 sub_modules = graphql_modules.get(base_module)
196 if not sub_modules:
197 return
198 sub_module = target.split(".", 1)[0]
199 if sub_module not in sub_modules:
200 return None
201 target = "graphql." + base_module + "." + target.rsplit(".", 1)[-1]
202 else: # maybe not specific enough
203 base_module = graphql_classes.get(target)
204 if not base_module:
205 return None
206 target = "graphql." + base_module + "." + target
207 # replace target
208 if contnode.__class__.__name__ == "Text":
209 contnode = contnode.__class__(target)
210 elif contnode.__class__.__name__ == "literal":
211 if len(contnode.children) != 1:
212 return None
213 textnode = contnode.children[0]
214 contnode.children[0] = textnode.__class__(target)
215 else:
216 return None
217 node["reftarget"] = target
218 fromdoc = node.get("refdoc")
219 if not fromdoc:
220 doc_module = node.get("py:module")
221 if doc_module:
222 if doc_module.startswith("graphql."):
223 doc_module = doc_module.split(".", 1)[-1]
224 if doc_module not in graphql_modules and doc_module != "graphql":
225 doc_module = None
226 fromdoc = "modules/" + (doc_module or base_module)
227 # try resolving again with replaced target
228 return env.domains["py"].resolve_xref(
229 env, fromdoc, app.builder, typ, target, node, contnode
230 )
231
232
233 def on_skip_member(_app, what, name, _obj, skip, _options):
234 if what == "class" and name == "__init__":
235 # we could set "special-members" to "__init__",
236 # but this gives an error when documenting modules
237 return False
238 return skip
239
240
241 def setup(app):
242 app.connect("missing-reference", on_missing_reference)
243 app.connect("autodoc-skip-member", on_skip_member)
244
245
246 # be nitpicky (handle all possible problems in on_missing_reference)
247 nitpicky = True
248
249
250 # The reST default role (used for this markup: `text`) to use for all
251 # documents.
252 #
253 # default_role = None
254
255 # If true, '()' will be appended to :func: etc. cross-reference text.
256 #
257 # add_function_parentheses = True
258
259 # If true, the current module name will be prepended to all description
260 # unit titles (such as .. function::).
261 #
262 # add_module_names = True
263
264 # If true, sectionauthor and moduleauthor directives will be shown in the
265 # output. They are ignored by default.
266 #
267 # show_authors = False
268
269 # The name of the Pygments (syntax highlighting) style to use.
270 pygments_style = "sphinx"
271
272 # A list of ignored prefixes for module index sorting.
273 # modindex_common_prefix = []
274
275 # If true, keep warnings as "system message" paragraphs in the built documents.
276 # keep_warnings = False
277
278 # If true, `todo` and `todoList` produce output, else they produce nothing.
279 todo_include_todos = False
280
281 # -- Options for HTML output ----------------------------------------------
282
283 # The theme to use for HTML and HTML Help pages. See the documentation for
284 # a list of builtin themes.
285 #
286 html_theme = "sphinx_rtd_theme"
287
288 # Theme options are theme-specific and customize the look and feel of a theme
289 # further. For a list of options available for each theme, see the
290 # documentation.
291 #
292 html_theme_options = {"navigation_depth": 5}
293
294 # Add any paths that contain custom themes here, relative to this directory.
295 # html_theme_path = []
296
297 # The name for this set of Sphinx documents.
298 # "<project> v<release> documentation" by default.
299 #
300 # html_title = 'GraphQL-core v3.1.0'
301
302 # A shorter title for the navigation bar. Default is the same as html_title.
303 #
304 # html_short_title = None
305
306 # The name of an image file (relative to this directory) to place at the top
307 # of the sidebar.
308 #
309 # html_logo = None
310
311 # The name of an image file (relative to this directory) to use as a favicon of
312 # the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
313 # pixels large.
314 #
315 # html_favicon = None
316
317 # Add any paths that contain custom static files (such as style sheets) here,
318 # relative to this directory. They are copied after the builtin static files,
319 # so a file named "default.css" will overwrite the builtin "default.css".
320 # html_static_path = ['_static']
321
322 # Add any extra paths that contain custom files (such as robots.txt or
323 # .htaccess) here, relative to this directory. These files are copied
324 # directly to the root of the documentation.
325 #
326 # html_extra_path = []
327
328 # If not None, a 'Last updated on:' timestamp is inserted at every page
329 # bottom, using the given strftime format.
330 # The empty string is equivalent to '%b %d, %Y'.
331 #
332 # html_last_updated_fmt = None
333
334 # If true, SmartyPants will be used to convert quotes and dashes to
335 # typographically correct entities.
336 #
337 # html_use_smartypants = True
338
339 # Custom sidebar templates, maps document names to template names.
340 #
341 # html_sidebars = {}
342
343 # Additional templates that should be rendered to pages, maps page names to
344 # template names.
345 #
346 # html_additional_pages = {}
347
348 # If false, no module index is generated.
349 #
350 # html_domain_indices = True
351
352 # If false, no index is generated.
353 #
354 # html_use_index = True
355
356 # If true, the index is split into individual pages for each letter.
357 #
358 # html_split_index = False
359
360 # If true, links to the reST sources are added to the pages.
361 #
362 html_show_sourcelink = False
363
364 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
365 #
366 # html_show_sphinx = True
367
368 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
369 #
370 # html_show_copyright = True
371
372 # If true, an OpenSearch description file will be output, and all pages will
373 # contain a <link> tag referring to it. The value of this option must be the
374 # base URL from which the finished HTML is served.
375 #
376 # html_use_opensearch = ''
377
378 # This is the file name suffix for HTML files (e.g. ".xhtml").
379 # html_file_suffix = None
380
381 # Language to be used for generating the HTML full-text search index.
382 # Sphinx supports the following languages:
383 # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
384 # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh'
385 #
386 # html_search_language = 'en'
387
388 # A dictionary with options for the search language support, empty by default.
389 # 'ja' uses this config value.
390 # 'zh' user can custom change `jieba` dictionary path.
391 #
392 # html_search_options = {'type': 'default'}
393
394 # The name of a javascript file (relative to the configuration directory) that
395 # implements a search results scorer. If empty, the default will be used.
396 #
397 # html_search_scorer = 'scorer.js'
398
399 # Output file base name for HTML help builder.
400 htmlhelp_basename = "GraphQL-core-3-doc"
401
402 # -- Options for LaTeX output ---------------------------------------------
403
404 latex_elements = {
405 # The paper size ('letterpaper' or 'a4paper').
406 #
407 # 'papersize': 'letterpaper',
408 # The font size ('10pt', '11pt' or '12pt').
409 #
410 # 'pointsize': '10pt',
411 # Additional stuff for the LaTeX preamble.
412 #
413 # 'preamble': '',
414 # Latex figure (float) alignment
415 #
416 # 'figure_align': 'htbp',
417 }
418
419 # Grouping the document tree into LaTeX files. List of tuples
420 # (source start file, target name, title,
421 # author, documentclass [howto, manual, or own class]).
422 latex_documents = [
423 (
424 master_doc,
425 "GraphQL-core-3.tex",
426 "GraphQL-core 3 Documentation",
427 "Christoph Zwerschke",
428 "manual",
429 ),
430 ]
431
432 # The name of an image file (relative to this directory) to place at the top of
433 # the title page.
434 #
435 # latex_logo = None
436
437 # For "manual" documents, if this is true, then toplevel headings are parts,
438 # not chapters.
439 #
440 # latex_use_parts = False
441
442 # If true, show page references after internal links.
443 #
444 # latex_show_pagerefs = False
445
446 # If true, show URL addresses after external links.
447 #
448 # latex_show_urls = False
449
450 # Documents to append as an appendix to all manuals.
451 #
452 # latex_appendices = []
453
454 # If false, no module index is generated.
455 #
456 # latex_domain_indices = True
457
458
459 # -- Options for manual page output ---------------------------------------
460
461 # One entry per manual page. List of tuples
462 # (source start file, name, description, authors, manual section).
463 man_pages = [(master_doc, "graphql-core", "GraphQL-core 3 Documentation", [author], 1)]
464
465 # If true, show URL addresses after external links.
466 #
467 # man_show_urls = False
468
469
470 # -- Options for Texinfo output -------------------------------------------
471
472 # Grouping the document tree into Texinfo files. List of tuples
473 # (source start file, target name, title, author,
474 # dir menu entry, description, category)
475 texinfo_documents = [
476 (
477 master_doc,
478 "GraphQL-core",
479 "GraphQL-core 3 Documentation",
480 author,
481 "GraphQL-core 3",
482 "One line description of project.",
483 "Miscellaneous",
484 ),
485 ]
486
487 # Documents to append as an appendix to all manuals.
488 #
489 # texinfo_appendices = []
490
491 # If false, no module index is generated.
492 #
493 # texinfo_domain_indices = True
494
495 # How to display URL addresses: 'footnote', 'no', or 'inline'.
496 #
497 # texinfo_show_urls = 'footnote'
498
499 # If true, do not generate a @detailmenu in the "Top" node's menu.
500 #
501 # texinfo_no_detailmenu = False