conf.py

  1# -*- coding: utf-8 -*-
  2
  3# Default settings
  4project = 'Test Builds'
  5extensions = [
  6    'sphinx_autorun',
  7]
  8
  9latex_engine = 'xelatex'  # allow us to build Unicode chars
 10
 11
 12# Include all your settings here
 13html_theme = 'sphinx_rtd_theme'
 14
 15
 16
 17
 18###########################################################################
 19#          auto-created readthedocs.org specific configuration            #
 20###########################################################################
 21
 22
 23#
 24# The following code was added during an automated build on readthedocs.org
 25# It is auto created and injected for every build. The result is based on the
 26# conf.py.tmpl file found in the readthedocs.org codebase:
 27# https://github.com/rtfd/readthedocs.org/blob/main/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl
 28#
 29# Note: this file shouldn't rely on extra dependencies.
 30
 31import importlib
 32import sys
 33import os.path
 34
 35# Borrowed from six.
 36PY3 = sys.version_info[0] == 3
 37string_types = str if PY3 else basestring
 38
 39from sphinx import version_info
 40
 41# Get suffix for proper linking to GitHub
 42# This is deprecated in Sphinx 1.3+,
 43# as each page can have its own suffix
 44if globals().get('source_suffix', False):
 45    if isinstance(source_suffix, string_types):
 46        SUFFIX = source_suffix
 47    elif isinstance(source_suffix, (list, tuple)):
 48        # Sphinx >= 1.3 supports list/tuple to define multiple suffixes
 49        SUFFIX = source_suffix[0]
 50    elif isinstance(source_suffix, dict):
 51        # Sphinx >= 1.8 supports a mapping dictionary for multiple suffixes
 52        SUFFIX = list(source_suffix.keys())[0]  # make a ``list()`` for py2/py3 compatibility
 53    else:
 54        # default to .rst
 55        SUFFIX = '.rst'
 56else:
 57    SUFFIX = '.rst'
 58
 59# Add RTD Static Path. Add to the end because it overwrites previous files.
 60if not 'html_static_path' in globals():
 61    html_static_path = []
 62if os.path.exists('_static'):
 63    html_static_path.append('_static')
 64
 65# Add RTD Theme only if they aren't overriding it already
 66using_rtd_theme = (
 67    (
 68        'html_theme' in globals() and
 69        html_theme in ['default'] and
 70        # Allow people to bail with a hack of having an html_style
 71        'html_style' not in globals()
 72    ) or 'html_theme' not in globals()
 73)
 74if using_rtd_theme:
 75    html_theme = 'sphinx_rtd_theme'
 76    html_style = None
 77    html_theme_options = {}
 78
 79
 80# This following legacy behavior will gradually be sliced out until its deprecated and removed.
 81# Skipped for Sphinx 6+
 82# Skipped by internal Feature flag SKIP_SPHINX_HTML_THEME_PATH
 83# Skipped by all new projects since SKIP_SPHINX_HTML_THEME_PATH's introduction (jan 2023)
 84if (
 85        using_rtd_theme
 86        and version_info < (6,0)
 87        and not False
 88    ):
 89    theme = importlib.import_module('sphinx_rtd_theme')
 90    if 'html_theme_path' in globals():
 91        html_theme_path.append(theme.get_html_theme_path())
 92    else:
 93        html_theme_path = [theme.get_html_theme_path()]
 94
 95# Define websupport2_base_url and websupport2_static_url
 96if globals().get('websupport2_base_url', False):
 97    websupport2_base_url = 'https://readthedocs.org/websupport'
 98    websupport2_static_url = 'https://assets.readthedocs.org/static/'
 99
100
101#Add project information to the template context.
102context = {
103    'using_theme': using_rtd_theme,
104    'html_theme': html_theme,
105    'current_version': "skip-build-command",
106    'version_slug': "skip-build-command",
107    'MEDIA_URL': "https://media.readthedocs.org/",
108    'STATIC_URL': "https://assets.readthedocs.org/static/",
109    'PRODUCTION_DOMAIN': "readthedocs.org",
110    'proxied_static_path': "/_/static/",
111    'versions': [
112    ("latest", "/en/latest/"),
113    ("4.0", "/en/4.0/"),
114    ("2.0", "/en/2.0/"),
115    ("yaml-v2", "/en/yaml-v2/"),
116    ("wormhole", "/en/wormhole/"),
117    ("use-requirements-from-submodule", "/en/use-requirements-from-submodule/"),
118    ("use-py2", "/en/use-py2/"),
119    ("use-apt", "/en/use-apt/"),
120    ("unicode-filename", "/en/unicode-filename/"),
121    ("d--branch", "/en/d--branch/"),
122    ("ubuntu-22.04", "/en/ubuntu-22.04/"),
123    ("ubuntu-20.04-python-3.9", "/en/ubuntu-20.04-python-3.9/"),
124    ("ubuntu-20.04", "/en/ubuntu-20.04/"),
125    ("typlog-theme", "/en/typlog-theme/"),
126    ("timetestlarge", "/en/timetestlarge/"),
127    ("timetest", "/en/timetest/"),
128    ("timeout", "/en/timeout/"),
129    ("throw-exception", "/en/throw-exception/"),
130    ("test-ubuntu-20.04", "/en/test-ubuntu-20.04/"),
131    ("test-paths-with-spaces", "/en/test-paths-with-spaces/"),
132    ("testing-activate-version", "/en/testing-activate-version/"),
133    ("sudo-commands", "/en/sudo-commands/"),
134    ("submodule-not-found", "/en/submodule-not-found/"),
135    ("submodule-https-scheme", "/en/submodule-https-scheme/"),
136    ("submodule-git-scheme", "/en/submodule-git-scheme/"),
137    ("staticrypt", "/en/staticrypt/"),
138    ("sphinx-tectonic-pdf", "/en/sphinx-tectonic-pdf/"),
139    ("sphinx-tabs", "/en/sphinx-tabs/"),
140    ("sphinx-multipage-html", "/en/sphinx-multipage-html/"),
141    ("sphinx-mkdocstrings", "/en/sphinx-mkdocstrings/"),
142    ("sphinx-latest", "/en/sphinx-latest/"),
143    ("sphinx-hoverxref", "/en/sphinx-hoverxref/"),
144    ("sphinx.ext.duration", "/en/sphinx.ext.duration/"),
145    ("sphinx-es-suggest", "/en/sphinx-es-suggest/"),
146    ("sphinx-docs-zundler", "/en/sphinx-docs-zundler/"),
147    ("sphinx-conf-nonstandard", "/en/sphinx-conf-nonstandard/"),
148    ("sphinx-7.0.x", "/en/sphinx-7.0.x/"),
149    ("sphinx6.x-default", "/en/sphinx6.x-default/"),
150    ("sphinx5.x-default-confpy", "/en/sphinx5.x-default-confpy/"),
151    ("sphinx-5.x", "/en/sphinx-5.x/"),
152    ("skip-build-command", "/en/skip-build-command/"),
153    ("singlehtml", "/en/singlehtml/"),
154    ("shot-scraper", "/en/shot-scraper/"),
155    ("search-with-old-sphinx-and-theme", "/en/search-with-old-sphinx-and-theme/"),
156    ("search-special-chars", "/en/search-special-chars/"),
157    ("rust", "/en/rust/"),
158    ("robots-txt", "/en/robots-txt/"),
159    ("requirements-not-found", "/en/requirements-not-found/"),
160    ("regular-404-page", "/en/regular-404-page/"),
161    ("recommonmark", "/en/recommonmark/"),
162    ("readthedocs-docs-build-commands", "/en/readthedocs-docs-build-commands/"),
163    ("pypy3.5", "/en/pypy3.5/"),
164    ("pygments-custom-lexer-apex", "/en/pygments-custom-lexer-apex/"),
165    ("py3.9", "/en/py3.9/"),
166    ("py3.8", "/en/py3.8/"),
167    ("py3.11", "/en/py3.11/"),
168    ("py3.10", "/en/py3.10/"),
169    ("pr-visual-diff", "/en/pr-visual-diff/"),
170    ("pr-js-client", "/en/pr-js-client/"),
171    ("pr-homepage-edition", "/en/pr-homepage-edition/"),
172    ("poetry-asdf", "/en/poetry-asdf/"),
173    ("poetry", "/en/poetry/"),
174    ("pelican", "/en/pelican/"),
175    ("pdf-rinohtype", "/en/pdf-rinohtype/"),
176    ("pdf-cmd-fail", "/en/pdf-cmd-fail/"),
177    ("path-with-plus", "/en/path-with-plus/"),
178    ("old-output-directory", "/en/old-output-directory/"),
179    ("no-conf-py", "/en/no-conf-py/"),
180    ("no-config-file", "/en/no-config-file/"),
181    ("nbsphinx-3d-plot", "/en/nbsphinx-3d-plot/"),
182    ("multiple-source-suffix", "/en/multiple-source-suffix/"),
183    ("monorepo", "/en/monorepo/"),
184    ("mkdocs-python-tags", "/en/mkdocs-python-tags/"),
185    ("mkdocs-pdf", "/en/mkdocs-pdf/"),
186    ("mkdocs-material", "/en/mkdocs-material/"),
187    ("mkdocs-htmlzip", "/en/mkdocs-htmlzip/"),
188    ("mkdocs-config-at-root", "/en/mkdocs-config-at-root/"),
189    ("mkdocs", "/en/mkdocs/"),
190    ("meta-tags", "/en/meta-tags/"),
191    ("manual-integrations", "/en/manual-integrations/"),
192    ("manual-integration-docsify", "/en/manual-integration-docsify/"),
193    ("mamba", "/en/mamba/"),
194    ("linkcheck", "/en/linkcheck/"),
195    ("jupyter-book", "/en/jupyter-book/"),
196    ("jsdoc-autoapi", "/en/jsdoc-autoapi/"),
197    ("jsdoc", "/en/jsdoc/"),
198    ("japanese-pdf", "/en/japanese-pdf/"),
199    ("invalid-submodules", "/en/invalid-submodules/"),
200    ("invalid-docker-image", "/en/invalid-docker-image/"),
201    ("install-setuptools", "/en/install-setuptools/"),
202    ("huge-build-output", "/en/huge-build-output/"),
203    ("htmldir", "/en/htmldir/"),
204    ("git-submodules-invalid", "/en/git-submodules-invalid/"),
205    ("git-submodules", "/en/git-submodules/"),
206    ("git-lfs-build-jobs", "/en/git-lfs-build-jobs/"),
207    ("furo", "/en/furo/"),
208    ("file-with-apostrophe", "/en/file-with-apostrophe/"),
209    ("expose-env-pip-error", "/en/expose-env-pip-error/"),
210    ("explicit-flyout-placement", "/en/explicit-flyout-placement/"),
211    ("envvar-config-file", "/en/envvar-config-file/"),
212    ("environment-variables", "/en/environment-variables/"),
213    ("docusaurus", "/en/docusaurus/"),
214    ("docsify-ads", "/en/docsify-ads/"),
215    ("docsify", "/en/docsify/"),
216    ("datetime", "/en/datetime/"),
217    ("d2lbook", "/en/d2lbook/"),
218    ("custom-404-page", "/en/custom-404-page/"),
219    ("conda-pin-common-deps", "/en/conda-pin-common-deps/"),
220    ("conda-env-py3.7", "/en/conda-env-py3.7/"),
221    ("conda-env-no-py-pinned", "/en/conda-env-no-py-pinned/"),
222    ("conda-env", "/en/conda-env/"),
223    ("c-dependencies", "/en/c-dependencies/"),
224    ("build-tools-mamba", "/en/build-tools-mamba/"),
225    ("build-tools-conda", "/en/build-tools-conda/"),
226    ("build-tools", "/en/build-tools/"),
227    ("build-os-error-message", "/en/build-os-error-message/"),
228    ("build-latest-python-3.8", "/en/build-latest-python-3.8/"),
229    ("build-jobs-spaces-in-command", "/en/build-jobs-spaces-in-command/"),
230    ("build-jobs-post-build", "/en/build-jobs-post-build/"),
231    ("build-jobs-multiline", "/en/build-jobs-multiline/"),
232    ("build-jobs-diff-exit", "/en/build-jobs-diff-exit/"),
233    ("build-jobs", "/en/build-jobs/"),
234    ("build-internals", "/en/build-internals/"),
235    ("build-commands-env-vars", "/en/build-commands-env-vars/"),
236    ("build-commands", "/en/build-commands/"),
237    ("branch-with-slashes", "/en/branch-with-slashes/"),
238    ("bare-commands", "/en/bare-commands/"),
239    ("another-matching-branch", "/en/another-matching-branch/"),
240    ("annotated-tag", "/en/annotated-tag/"),
241    ("all-formats-build-jobs", "/en/all-formats-build-jobs/"),
242    ("all-formats-build-commands", "/en/all-formats-build-commands/"),
243    ("all-formats", "/en/all-formats/"),
244    ("alabaster-theme", "/en/alabaster-theme/"),
245    ],
246    'downloads': [ 
247    ],
248    'subprojects': [ 
249    ],
250    'slug': 'test-builds',
251    'name': u'test-builds',
252    'rtd_language': u'en',
253    'programming_language': u'words',
254    'canonical_url': 'https://test-builds.readthedocs.io/en/latest/',
255    'analytics_code': 'UA-12341234-1',
256    'single_version': False,
257    'conf_py_path': '/docs/',
258    'api_host': 'https://readthedocs.org',
259    'github_user': 'readthedocs',
260    'proxied_api_host': '/_',
261    'github_repo': 'test-builds',
262    'github_version': 'skip-build-command',
263    'display_github': True,
264    'bitbucket_user': 'None',
265    'bitbucket_repo': 'None',
266    'bitbucket_version': 'skip-build-command',
267    'display_bitbucket': False,
268    'gitlab_user': 'None',
269    'gitlab_repo': 'None',
270    'gitlab_version': 'skip-build-command',
271    'display_gitlab': False,
272    'READTHEDOCS': True,
273    'using_theme': (html_theme == "default"),
274    'new_theme': (html_theme == "sphinx_rtd_theme"),
275    'source_suffix': SUFFIX,
276    'ad_free': False,
277    'docsearch_disabled': False,
278    'user_analytics_code': 'UA-12341234-1',
279    'global_analytics_code': None,
280    'commit': '554dbcff',
281}
282
283# For sphinx >=1.8 we can use html_baseurl to set the canonical URL.
284# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_baseurl
285if version_info >= (1, 8):
286    if not globals().get('html_baseurl'):
287        html_baseurl = context['canonical_url']
288    context['canonical_url'] = None
289
290
291
292
293
294if 'html_context' in globals():
295    
296    html_context.update(context)
297    
298else:
299    html_context = context
300
301# Add custom RTD extension
302if 'extensions' in globals():
303    # Insert at the beginning because it can interfere
304    # with other extensions.
305    # See https://github.com/rtfd/readthedocs.org/pull/4054
306    extensions.insert(0, "readthedocs_ext.readthedocs")
307else:
308    extensions = ["readthedocs_ext.readthedocs"]
309
310# Add External version warning banner to the external version documentation
311if 'branch' == 'external':
312    extensions.insert(1, "readthedocs_ext.external_version_warning")
313    readthedocs_vcs_url = 'None'
314    readthedocs_build_url = 'https://readthedocs.org/projects/test-builds/builds/20716439/'
315
316project_language = 'en'
317
318# User's Sphinx configurations
319language_user = globals().get('language', None)
320latex_engine_user = globals().get('latex_engine', None)
321latex_elements_user = globals().get('latex_elements', None)
322
323# Remove this once xindy gets installed in Docker image and XINDYOPS
324# env variable is supported
325# https://github.com/rtfd/readthedocs-docker-images/pull/98
326latex_use_xindy = False
327
328chinese = any([
329    language_user in ('zh_CN', 'zh_TW'),
330    project_language in ('zh_CN', 'zh_TW'),
331])
332
333japanese = any([
334    language_user == 'ja',
335    project_language == 'ja',
336])
337
338if chinese:
339    latex_engine = latex_engine_user or 'xelatex'
340
341    latex_elements_rtd = {
342        'preamble': '\\usepackage[UTF8]{ctex}\n',
343    }
344    latex_elements = latex_elements_user or latex_elements_rtd
345elif japanese:
346    latex_engine = latex_engine_user or 'platex'
347
348# Make sure our build directory is always excluded
349exclude_patterns = globals().get('exclude_patterns', [])
350exclude_patterns.extend(['_build'])