2009-01-10 13:45:45 -06:00
|
|
|
# Sphinx documentation build configuration file
|
2008-03-09 16:32:24 -05:00
|
|
|
|
2022-01-08 00:12:33 -06:00
|
|
|
import os
|
2010-01-17 11:16:14 -06:00
|
|
|
import re
|
2022-07-10 16:48:15 -05:00
|
|
|
import time
|
2018-01-27 10:52:16 -06:00
|
|
|
|
2010-01-17 11:16:14 -06:00
|
|
|
import sphinx
|
2017-03-23 05:03:38 -05:00
|
|
|
|
2023-09-13 16:58:35 -05:00
|
|
|
os.environ['SPHINX_AUTODOC_RELOAD_MODULES'] = '1'
|
|
|
|
|
2009-04-04 14:05:04 -05:00
|
|
|
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo',
|
2014-10-27 23:45:27 -05:00
|
|
|
'sphinx.ext.autosummary', 'sphinx.ext.extlinks',
|
2020-03-09 05:41:14 -05:00
|
|
|
'sphinx.ext.intersphinx',
|
2023-07-27 20:33:42 -05:00
|
|
|
'sphinx.ext.viewcode', 'sphinx.ext.inheritance_diagram',
|
|
|
|
'sphinx.ext.coverage']
|
|
|
|
coverage_statistics_to_report = coverage_statistics_to_stdout = True
|
2010-01-17 11:16:14 -06:00
|
|
|
templates_path = ['_templates']
|
2010-01-06 08:48:39 -06:00
|
|
|
exclude_patterns = ['_build']
|
|
|
|
|
2008-03-09 16:32:24 -05:00
|
|
|
project = 'Sphinx'
|
2022-07-10 16:48:15 -05:00
|
|
|
copyright = f'2007-{time.strftime("%Y")}, the Sphinx developers'
|
2017-04-27 11:19:01 -05:00
|
|
|
version = sphinx.__display_version__
|
2008-04-27 15:12:41 -05:00
|
|
|
release = version
|
2008-03-09 16:32:24 -05:00
|
|
|
show_authors = True
|
2023-09-21 03:01:58 -05:00
|
|
|
nitpicky = True
|
2008-03-09 16:32:24 -05:00
|
|
|
|
2013-01-18 16:17:11 -06:00
|
|
|
html_theme = 'sphinx13'
|
|
|
|
html_theme_path = ['_themes']
|
2022-07-10 16:48:15 -05:00
|
|
|
html_css_files = [
|
|
|
|
# 'basic.css', # included through inheritance from the basic theme
|
|
|
|
'sphinx13.css',
|
|
|
|
]
|
2009-01-10 14:54:26 -06:00
|
|
|
modindex_common_prefix = ['sphinx.']
|
2008-03-21 10:20:50 -05:00
|
|
|
html_static_path = ['_static']
|
2021-02-07 06:23:41 -06:00
|
|
|
html_title = 'Sphinx documentation'
|
2022-07-10 16:48:15 -05:00
|
|
|
html_additional_pages = {'contents': 'contents.html'}
|
2020-04-18 05:02:17 -05:00
|
|
|
html_use_opensearch = 'https://www.sphinx-doc.org/en/master'
|
2020-04-17 10:01:48 -05:00
|
|
|
html_baseurl = 'https://www.sphinx-doc.org/en/master/'
|
2020-10-24 10:20:24 -05:00
|
|
|
html_favicon = '_static/favicon.svg'
|
2008-04-27 13:09:49 -05:00
|
|
|
|
2008-03-09 16:32:24 -05:00
|
|
|
htmlhelp_basename = 'Sphinxdoc'
|
|
|
|
|
2009-12-29 05:32:42 -06:00
|
|
|
epub_theme = 'epub'
|
2009-12-28 10:09:09 -06:00
|
|
|
epub_basename = 'sphinx'
|
2022-07-10 16:48:15 -05:00
|
|
|
epub_author = 'the Sphinx developers'
|
2021-09-06 14:59:00 -05:00
|
|
|
epub_publisher = 'https://www.sphinx-doc.org/'
|
2017-06-29 11:21:16 -05:00
|
|
|
epub_uid = 'web-site'
|
2009-12-28 10:09:09 -06:00
|
|
|
epub_scheme = 'url'
|
|
|
|
epub_identifier = epub_publisher
|
2016-07-20 20:08:27 -05:00
|
|
|
epub_pre_files = [('index.xhtml', 'Welcome')]
|
2018-04-11 10:48:59 -05:00
|
|
|
epub_post_files = [('usage/installation.xhtml', 'Installing Sphinx'),
|
2016-07-20 20:08:27 -05:00
|
|
|
('develop.xhtml', 'Sphinx development')]
|
2009-12-28 10:09:09 -06:00
|
|
|
epub_exclude_files = ['_static/opensearch.xml', '_static/doctools.js',
|
2022-06-16 15:05:37 -05:00
|
|
|
'_static/searchtools.js',
|
2022-09-23 14:06:48 -05:00
|
|
|
'_static/sphinx_highlight.js',
|
2022-06-16 15:05:37 -05:00
|
|
|
'_static/basic.css',
|
2018-11-04 03:13:07 -06:00
|
|
|
'_static/language_data.js',
|
2015-03-08 11:15:54 -05:00
|
|
|
'search.html', '_static/websupport.js']
|
2011-02-27 15:02:30 -06:00
|
|
|
epub_fix_images = False
|
2011-02-28 14:17:52 -06:00
|
|
|
epub_max_image_width = 0
|
2013-02-09 08:00:47 -06:00
|
|
|
epub_show_urls = 'inline'
|
2013-03-06 11:43:21 -06:00
|
|
|
epub_use_index = False
|
2016-09-30 10:17:19 -05:00
|
|
|
epub_description = 'Sphinx documentation generator system manual'
|
2009-12-28 10:09:09 -06:00
|
|
|
|
2022-07-10 16:48:15 -05:00
|
|
|
latex_documents = [('index', 'sphinx.tex', 'Sphinx Documentation',
|
|
|
|
'the Sphinx developers', 'manual', 1)]
|
2008-04-27 14:43:45 -05:00
|
|
|
latex_logo = '_static/sphinx.png'
|
2008-09-24 11:18:45 -05:00
|
|
|
latex_elements = {
|
2018-11-21 11:58:58 -06:00
|
|
|
'fontenc': r'\usepackage[LGR,X2,T1]{fontenc}',
|
2021-01-23 17:41:59 -06:00
|
|
|
'passoptionstopackages': r'''
|
|
|
|
\PassOptionsToPackage{svgnames}{xcolor}
|
|
|
|
''',
|
|
|
|
'preamble': r'''
|
|
|
|
\DeclareUnicodeCharacter{229E}{\ensuremath{\boxplus}}
|
2021-02-18 05:47:14 -06:00
|
|
|
\setcounter{tocdepth}{3}% depth of what main TOC shows (3=subsubsection)
|
2021-01-23 17:41:59 -06:00
|
|
|
\setcounter{secnumdepth}{1}% depth of section numbering
|
2022-10-30 11:09:30 -05:00
|
|
|
\setlength{\tymin}{2cm}% avoid too cramped table columns
|
2021-01-23 17:41:59 -06:00
|
|
|
''',
|
2018-07-31 03:46:48 -05:00
|
|
|
# fix missing index entry due to RTD doing only once pdflatex after makeindex
|
|
|
|
'printindex': r'''
|
|
|
|
\IfFileExists{\jobname.ind}
|
|
|
|
{\footnotesize\raggedright\printindex}
|
|
|
|
{\begin{sphinxtheindex}\end{sphinxtheindex}}
|
|
|
|
''',
|
2008-09-24 11:18:45 -05:00
|
|
|
}
|
2011-01-06 11:29:37 -06:00
|
|
|
latex_show_urls = 'footnote'
|
2018-07-13 07:37:39 -05:00
|
|
|
latex_use_xindy = True
|
2008-03-09 16:32:24 -05:00
|
|
|
|
2023-07-24 05:49:44 -05:00
|
|
|
linkcheck_timeout = 5
|
|
|
|
|
2010-02-28 07:45:43 -06:00
|
|
|
autodoc_member_order = 'groupwise'
|
2020-04-24 22:24:36 -05:00
|
|
|
autosummary_generate = False
|
2008-11-09 12:46:32 -06:00
|
|
|
todo_include_todos = True
|
2021-05-16 07:42:26 -05:00
|
|
|
extlinks = {'duref': ('https://docutils.sourceforge.io/docs/ref/rst/'
|
2021-04-11 08:20:24 -05:00
|
|
|
'restructuredtext.html#%s', '%s'),
|
2021-05-16 07:42:26 -05:00
|
|
|
'durole': ('https://docutils.sourceforge.io/docs/ref/rst/'
|
2021-04-11 08:20:24 -05:00
|
|
|
'roles.html#%s', '%s'),
|
2021-05-16 07:42:26 -05:00
|
|
|
'dudir': ('https://docutils.sourceforge.io/docs/ref/rst/'
|
2021-04-11 08:20:24 -05:00
|
|
|
'directives.html#%s', '%s')}
|
2008-11-09 12:46:32 -06:00
|
|
|
|
2010-02-21 04:50:08 -06:00
|
|
|
man_pages = [
|
2022-07-10 16:48:15 -05:00
|
|
|
('index', 'sphinx-all', 'Sphinx documentation generator system manual',
|
|
|
|
'the Sphinx developers', 1),
|
2010-02-25 15:22:01 -06:00
|
|
|
('man/sphinx-build', 'sphinx-build', 'Sphinx documentation generator tool',
|
|
|
|
'', 1),
|
|
|
|
('man/sphinx-quickstart', 'sphinx-quickstart', 'Sphinx documentation '
|
|
|
|
'template generator', '', 1),
|
2011-10-07 05:27:19 -05:00
|
|
|
('man/sphinx-apidoc', 'sphinx-apidoc', 'Sphinx API doc generator tool',
|
|
|
|
'', 1),
|
2017-07-11 09:58:20 -05:00
|
|
|
('man/sphinx-autogen', 'sphinx-autogen', 'Generate autodoc stub pages',
|
|
|
|
'', 1),
|
2010-02-21 04:50:08 -06:00
|
|
|
]
|
|
|
|
|
2010-09-16 02:16:27 -05:00
|
|
|
texinfo_documents = [
|
2022-07-10 16:48:15 -05:00
|
|
|
('index', 'sphinx', 'Sphinx Documentation', 'the Sphinx developers',
|
2010-09-16 02:16:27 -05:00
|
|
|
'Sphinx', 'The Sphinx documentation builder.', 'Documentation tools',
|
|
|
|
1),
|
|
|
|
]
|
|
|
|
|
2020-10-04 14:40:14 -05:00
|
|
|
intersphinx_mapping = {
|
|
|
|
'python': ('https://docs.python.org/3/', None),
|
2022-05-28 09:04:55 -05:00
|
|
|
'requests': ('https://requests.readthedocs.io/en/latest/', None),
|
2021-11-18 08:58:53 -06:00
|
|
|
'readthedocs': ('https://docs.readthedocs.io/en/stable', None),
|
2020-10-04 14:40:14 -05:00
|
|
|
}
|
2010-08-05 06:39:23 -05:00
|
|
|
|
2013-03-30 22:22:08 -05:00
|
|
|
# Sphinx document translation with sphinx gettext feature uses these settings:
|
|
|
|
locale_dirs = ['locale/']
|
|
|
|
gettext_compact = False
|
|
|
|
|
2023-04-06 17:11:39 -05:00
|
|
|
nitpick_ignore = {
|
|
|
|
('cpp:class', 'template<typename TOuter> template<typename TInner> Wrapper::Outer<TOuter>::Inner'), # NoQA: E501
|
|
|
|
('cpp:identifier', 'MyContainer'),
|
|
|
|
('js:func', 'SomeError'),
|
|
|
|
('js:func', 'number'),
|
|
|
|
('js:func', 'string'),
|
|
|
|
('py:attr', 'srcline'),
|
|
|
|
('py:class', 'Element'), # sphinx.domains.Domain
|
2023-07-24 20:07:23 -05:00
|
|
|
('py:class', 'IndexEntry'), # sphinx.domains.IndexEntry
|
2023-04-06 17:11:39 -05:00
|
|
|
('py:class', 'Node'), # sphinx.domains.Domain
|
2023-07-24 20:07:23 -05:00
|
|
|
('py:class', 'NullTranslations'), # gettext.NullTranslations
|
2023-04-06 17:11:39 -05:00
|
|
|
('py:class', 'RoleFunction'), # sphinx.domains.Domain
|
|
|
|
('py:class', 'Theme'), # sphinx.application.TemplateBridge
|
|
|
|
('py:class', 'TitleGetter'), # sphinx.domains.Domain
|
|
|
|
('py:class', 'XRefRole'), # sphinx.domains.Domain
|
|
|
|
('py:class', 'docutils.nodes.Element'),
|
|
|
|
('py:class', 'docutils.nodes.Node'),
|
|
|
|
('py:class', 'docutils.nodes.NodeVisitor'),
|
|
|
|
('py:class', 'docutils.nodes.TextElement'),
|
|
|
|
('py:class', 'docutils.nodes.document'),
|
|
|
|
('py:class', 'docutils.nodes.system_message'),
|
|
|
|
('py:class', 'docutils.parsers.Parser'),
|
|
|
|
('py:class', 'docutils.parsers.rst.states.Inliner'),
|
|
|
|
('py:class', 'docutils.transforms.Transform'),
|
|
|
|
('py:class', 'nodes.NodeVisitor'),
|
|
|
|
('py:class', 'nodes.document'),
|
|
|
|
('py:class', 'nodes.reference'),
|
|
|
|
('py:class', 'pygments.lexer.Lexer'),
|
|
|
|
('py:class', 'sphinx.directives.ObjDescT'),
|
|
|
|
('py:class', 'sphinx.domains.IndexEntry'),
|
|
|
|
('py:class', 'sphinx.ext.autodoc.Documenter'),
|
|
|
|
('py:class', 'sphinx.errors.NoUri'),
|
|
|
|
('py:class', 'sphinx.roles.XRefRole'),
|
|
|
|
('py:class', 'sphinx.search.SearchLanguage'),
|
|
|
|
('py:class', 'sphinx.theming.Theme'),
|
|
|
|
('py:class', 'sphinxcontrib.websupport.errors.DocumentNotFoundError'),
|
|
|
|
('py:class', 'sphinxcontrib.websupport.errors.UserNotAuthorizedError'),
|
|
|
|
('py:exc', 'docutils.nodes.SkipNode'),
|
|
|
|
('py:exc', 'sphinx.environment.NoUri'),
|
|
|
|
('py:func', 'setup'),
|
|
|
|
('py:func', 'sphinx.util.nodes.nested_parse_with_titles'),
|
|
|
|
# Error in sphinxcontrib.websupport.core::WebSupport.add_comment
|
|
|
|
('py:meth', 'get_comments'),
|
|
|
|
('py:mod', 'autodoc'),
|
|
|
|
('py:mod', 'docutils.nodes'),
|
|
|
|
('py:mod', 'docutils.parsers.rst.directives'),
|
|
|
|
('py:mod', 'sphinx.ext'),
|
|
|
|
('py:obj', 'sphinx.util.relative_uri'),
|
|
|
|
('rst:role', 'c:any'),
|
|
|
|
('std:confval', 'autodoc_inherit_docstring'),
|
|
|
|
('std:confval', 'automodule_skip_lines'),
|
|
|
|
('std:confval', 'autossummary_imported_members'),
|
|
|
|
('std:confval', 'gettext_language_team'),
|
|
|
|
('std:confval', 'gettext_last_translator'),
|
|
|
|
('std:confval', 'globaltoc_collapse'),
|
|
|
|
('std:confval', 'globaltoc_includehidden'),
|
|
|
|
('std:confval', 'globaltoc_maxdepth'),
|
|
|
|
}
|
|
|
|
|
2008-11-09 12:46:32 -06:00
|
|
|
|
2009-01-10 13:45:45 -06:00
|
|
|
# -- Extension interface -------------------------------------------------------
|
2008-04-06 12:38:55 -05:00
|
|
|
|
2022-12-15 11:22:07 -06:00
|
|
|
from sphinx import addnodes # noqa: E402
|
2008-04-06 12:38:55 -05:00
|
|
|
|
2008-05-31 11:14:36 -05:00
|
|
|
event_sig_re = re.compile(r'([a-zA-Z-]+)\s*\((.*)\)')
|
|
|
|
|
2015-03-08 11:15:54 -05:00
|
|
|
|
2008-05-31 11:14:36 -05:00
|
|
|
def parse_event(env, sig, signode):
|
|
|
|
m = event_sig_re.match(sig)
|
|
|
|
if not m:
|
|
|
|
signode += addnodes.desc_name(sig, sig)
|
|
|
|
return sig
|
|
|
|
name, args = m.groups()
|
|
|
|
signode += addnodes.desc_name(name, name)
|
|
|
|
plist = addnodes.desc_parameterlist()
|
|
|
|
for arg in args.split(','):
|
|
|
|
arg = arg.strip()
|
|
|
|
plist += addnodes.desc_parameter(arg, arg)
|
|
|
|
signode += plist
|
|
|
|
return name
|
|
|
|
|
|
|
|
|
2022-01-08 00:12:33 -06:00
|
|
|
def linkify_issues_in_changelog(app, docname, source):
|
|
|
|
""" Linkify issue references like #123 in changelog to GitHub. """
|
|
|
|
|
|
|
|
if docname == 'changes':
|
2023-09-14 05:08:17 -05:00
|
|
|
changelog_path = os.path.join(os.path.dirname(__file__), "../CHANGES.rst")
|
2022-01-08 00:12:33 -06:00
|
|
|
# this path trickery is needed because this script can
|
|
|
|
# be invoked with different working directories:
|
|
|
|
# * running make in docs/
|
2022-04-16 13:02:38 -05:00
|
|
|
# * running tox -e docs in the repo root dir
|
2022-01-08 00:12:33 -06:00
|
|
|
|
2022-04-16 13:02:38 -05:00
|
|
|
with open(changelog_path, encoding="utf-8") as f:
|
2022-01-08 00:12:33 -06:00
|
|
|
changelog = f.read()
|
|
|
|
|
|
|
|
def linkify(match):
|
|
|
|
url = 'https://github.com/sphinx-doc/sphinx/issues/' + match[1]
|
2022-10-17 09:54:59 -05:00
|
|
|
return f'`{match[0]} <{url}>`_'
|
2022-01-08 00:12:33 -06:00
|
|
|
|
|
|
|
linkified_changelog = re.sub(r'(?:PR)?#([0-9]+)\b', linkify, changelog)
|
|
|
|
|
2023-09-14 05:08:17 -05:00
|
|
|
source[0] = source[0].replace('.. include:: ../CHANGES.rst', linkified_changelog)
|
2022-01-08 00:12:33 -06:00
|
|
|
|
|
|
|
|
2008-04-06 12:38:55 -05:00
|
|
|
def setup(app):
|
2008-06-22 16:02:50 -05:00
|
|
|
from sphinx.ext.autodoc import cut_lines
|
2011-01-07 09:27:47 -06:00
|
|
|
from sphinx.util.docfields import GroupedField
|
2008-06-22 16:02:50 -05:00
|
|
|
app.connect('autodoc-process-docstring', cut_lines(4, what=['module']))
|
2022-01-08 00:12:33 -06:00
|
|
|
app.connect('source-read', linkify_issues_in_changelog)
|
2011-01-07 09:27:47 -06:00
|
|
|
app.add_object_type('confval', 'confval',
|
|
|
|
objname='configuration value',
|
|
|
|
indextemplate='pair: %s; configuration value')
|
|
|
|
fdesc = GroupedField('parameter', label='Parameters',
|
|
|
|
names=['param'], can_collapse=True)
|
|
|
|
app.add_object_type('event', 'event', 'pair: %s; event', parse_event,
|
|
|
|
doc_field_types=[fdesc])
|