Debian Codegraph @

docs/conf.py

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 #
2 # django-polymorphic documentation build configuration file, created by
3 # sphinx-quickstart on Sun May 19 12:20:47 2013.
4 #
5 # This file is execfile()d with the current directory set to its containing dir.
6 #
7 # Note that not all possible configuration values are present in this
8 # autogenerated file.
9 #
10 # All configuration values have a default; values that are commented out
11 # serve to show the default.
12
13 import os
14 import shutil
15 import sys
16 from pathlib import Path
17
18 import django
19
20 # If extensions (or modules to document with autodoc) are in another directory,
21 # add these directories to sys.path here. If the directory is relative to the
22 # documentation root, use os.path.abspath to make it absolute, like shown here.
23 sys.path.insert(0, os.path.abspath("_ext"))
24 sys.path.insert(0, os.path.abspath(".."))
25 os.environ["DJANGO_SETTINGS_MODULE"] = "polymorphic.tests.settings"
26
27 django.setup()
28
29 import polymorphic # noqa: E402
30
31 # -- General configuration -----------------------------------------------------
32
33 # If your documentation needs a minimal Sphinx version, state it here.
34 # needs_sphinx = '1.0'
35
36 # Add any Sphinx extension module names here, as strings. They can be extensions
37 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
38 extensions = [
39 "sphinx.ext.autodoc",
40 "sphinx.ext.graphviz",
41 "sphinx.ext.intersphinx",
42 "sphinx.ext.todo",
43 "sphinxcontrib_django",
44 ]
45
46 # Add any paths that contain templates here, relative to this directory.
47 templates_path = ["_templates"]
48
49 # The suffix of source filenames.
50 source_suffix = ".rst"
51
52 # The encoding of source files.
53 # source_encoding = 'utf-8-sig'
54
55 # The master toctree document.
56 master_doc = "index"
57
58 # -- Project information -----------------------------------------------------
59 project = polymorphic.__title__
60 copyright = polymorphic.__copyright__
61 author = polymorphic.__author__
62 release = polymorphic.__version__
63 version = ".".join(polymorphic.__version__.split(".")[:2])
64
65
66 # The language for content autogenerated by Sphinx. Refer to documentation
67 # for a list of supported languages.
68 # language = None
69
70 # There are two options for replacing |today|: either, you set today to some
71 # non-false value, then it is used:
72 # today = ''
73 # Else, today_fmt is used as the format for a strftime call.
74 # today_fmt = '%B %d, %Y'
75
76 # List of patterns, relative to source directory, that match files and
77 # directories to ignore when looking for source files.
78 exclude_patterns = ["_build"]
79
80 # The reST default role (used for this markup: `text`) to use for all documents.
81 # default_role = None
82
83 # If true, '()' will be appended to :func: etc. cross-reference text.
84 # add_function_parentheses = True
85
86 # If true, the current module name will be prepended to all description
87 # unit titles (such as .. function::).
88 # add_module_names = True
89
90 # If true, sectionauthor and moduleauthor directives will be shown in the
91 # output. They are ignored by default.
92 # show_authors = False
93
94 # The name of the Pygments (syntax highlighting) style to use.
95 # pygments_style = "sphinx"
96
97 # A list of ignored prefixes for module index sorting.
98 # modindex_common_prefix = []
99
100
101 # -- Options for HTML output ---------------------------------------------------
102
103 # The theme to use for HTML and HTML Help pages. See the documentation for
104 # a list of builtin themes.
105 html_theme = "furo"
106 html_theme_options = {
107 "source_repository": "https://github.com/jazzband/django-polymorphic/",
108 "source_branch": "main",
109 "source_directory": "docs",
110 }
111
112 # Theme options are theme-specific and customize the look and feel of a theme
113 # further. For a list of options available for each theme, see the
114 # documentation.
115 # html_theme_options = {}
116
117 # Add any paths that contain custom themes here, relative to this directory.
118 # html_theme_path = []
119
120 # The name for this set of Sphinx documents. If None, it defaults to
121 # "<project> v<release> documentation".
122 # html_title = None
123
124 # A shorter title for the navigation bar. Default is the same as html_title.
125 # html_short_title = None
126
127 # The name of an image file (relative to this directory) to place at the top
128 # of the sidebar.
129 # html_logo = None
130
131 # The name of an image file (within the static path) to use as favicon of the
132 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
133 # pixels large.
134 # html_favicon = None
135
136 # Add any paths that contain custom static files (such as style sheets) here,
137 # relative to this directory. They are copied after the builtin static files,
138 # so a file named "default.css" will overwrite the builtin "default.css".
139 html_static_path = ["_static"]
140 html_css_files = [
141 "style.css",
142 ]
143
144 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
145 # using the given strftime format.
146 # html_last_updated_fmt = '%b %d, %Y'
147
148 # If true, SmartyPants will be used to convert quotes and dashes to
149 # typographically correct entities.
150 # html_use_smartypants = True
151
152 # Custom sidebar templates, maps document names to template names.
153 # html_sidebars = {}
154
155 # Additional templates that should be rendered to pages, maps page names to
156 # template names.
157 # html_additional_pages = {}
158
159 # If false, no module index is generated.
160 # html_domain_indices = True
161
162 # If false, no index is generated.
163 # html_use_index = True
164
165 # If true, the index is split into individual pages for each letter.
166 # html_split_index = False
167
168 # If true, links to the reST sources are added to the pages.
169 # html_show_sourcelink = True
170
171 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
172 # html_show_sphinx = True
173
174 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
175 # html_show_copyright = True
176
177 # If true, an OpenSearch description file will be output, and all pages will
178 # contain a <link> tag referring to it. The value of this option must be the
179 # base URL from which the finished HTML is served.
180 # html_use_opensearch = ''
181
182 # This is the file name suffix for HTML files (e.g. ".xhtml").
183 # html_file_suffix = None
184
185 # Output file base name for HTML help builder.
186 htmlhelp_basename = "django-polymorphicdoc"
187
188
189 # -- Options for LaTeX output --------------------------------------------------
190
191 latex_engine = "xelatex"
192 latex_elements = {
193 # The paper size ('letterpaper' or 'a4paper').
194 #'papersize': 'letterpaper',
195 # The font size ('10pt', '11pt' or '12pt').
196 #'pointsize': '10pt',
197 # Additional stuff for the LaTeX preamble.
198 #'preamble': '',
199 }
200
201 # Grouping the document tree into LaTeX files. List of tuples
202 # (source start file, target name, title, author, documentclass [howto/manual]).
203 latex_documents = [
204 (
205 "index",
206 "django-polymorphic.tex",
207 "django-polymorphic Documentation",
208 "Bert Constantin, Chris Glass, Diederik van der Boor, Brian Kohan",
209 "manual",
210 )
211 ]
212
213 # The name of an image file (relative to this directory) to place at the top of
214 # the title page.
215 # latex_logo = None
216
217 # For "manual" documents, if this is true, then toplevel headings are parts,
218 # not chapters.
219 # latex_use_parts = False
220
221 # If true, show page references after internal links.
222 # latex_show_pagerefs = False
223
224 # If true, show URL addresses after external links.
225 # latex_show_urls = False
226
227 # Documents to append as an appendix to all manuals.
228 # latex_appendices = []
229
230 # If false, no module index is generated.
231 # latex_domain_indices = True
232
233
234 # -- Options for manual page output --------------------------------------------
235
236 # One entry per manual page. List of tuples
237 # (source start file, name, description, authors, manual section).
238 man_pages = [
239 (
240 "index",
241 "django-polymorphic",
242 "django-polymorphic Documentation",
243 ["Bert Constantin, Chris Glass, Diederik van der Boor", "Brian Kohan"],
244 1,
245 )
246 ]
247
248 # If true, show URL addresses after external links.
249 # man_show_urls = False
250
251
252 # -- Options for Texinfo output ------------------------------------------------
253
254 # Grouping the document tree into Texinfo files. List of tuples
255 # (source start file, target name, title, author,
256 # dir menu entry, description, category)
257 texinfo_documents = [
258 (
259 "index",
260 "django-polymorphic",
261 "django-polymorphic Documentation",
262 "Bert Constantin, Chris Glass, Diederik van der Boor, Brian Kohan",
263 "django-polymorphic",
264 "One line description of project.",
265 "Miscellaneous",
266 )
267 ]
268
269 # Documents to append as an appendix to all manuals.
270 # texinfo_appendices = []
271
272 # If false, no module index is generated.
273 # texinfo_domain_indices = True
274
275 # How to display URL addresses: 'footnote', 'no', or 'inline'.
276 # texinfo_show_urls = 'footnote'
277
278
279 intersphinx_mapping = {
280 "django": (
281 "https://docs.djangoproject.com/en/stable",
282 "https://docs.djangoproject.com/en/stable/_objects/",
283 ),
284 "python": ("https://docs.python.org/3", None),
285 "typing-extensions": ("https://typing-extensions.readthedocs.io/en/latest/", None),
286 "django-guardian": ("https://django-guardian.readthedocs.io/en/stable", None),
287 "django-reversion": ("https://django-reversion.readthedocs.io/en/stable", None),
288 "django-extra-views": ("https://django-extra-views.readthedocs.io/en/stable", None),
289 "model-bakery": ("https://model-bakery.readthedocs.io/en/stable", None),
290 }
291
292 # autodoc settings
293 autodoc_default_options = {
294 "show-inheritance": True,
295 # Add other autodoc options here if desired, e.g.:
296 # 'members': True,
297 # 'inherited-members': True,
298 }
299 # In your Sphinx conf.py
300 autodoc_typehints = "description"
301 autodoc_typehints_format = "short"
302 autodoc_class_signature = "separated"
303 autodoc_member_order = "groupwise" # "bysource"
304
305 # sphinxcontrib-django / Sphinx 9+ autodoc compat
306 autodoc_use_legacy_class_based = True
307
308
309 def pypi_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
310 from docutils import nodes
311
312 url = f"https://pypi.org/project/{text}/"
313 node = nodes.reference(rawtext, text, refuri=url, **options)
314 return [node], []
315
316
317 def setup(app):
318 from docutils.parsers.rst import roles
319
320 # https://sphinxcontrib-typer.readthedocs.io/en/latest/howto.html#build-to-multiple-formats
321 if Path(app.doctreedir).exists():
322 shutil.rmtree(app.doctreedir)
323 app.add_crossref_type(directivename="django-admin", rolename="django-admin")
324 roles.register_local_role("pypi", pypi_role)
325 return app