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': "build-image",
106    'version_slug': "build-image",
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    ("stable", "/en/stable/"),
114    ("4.0", "/en/4.0/"),
115    ("2.0", "/en/2.0/"),
116    ("yaml-v2", "/en/yaml-v2/"),
117    ("wormhole", "/en/wormhole/"),
118    ("use-requirements-from-submodule", "/en/use-requirements-from-submodule/"),
119    ("use-py2", "/en/use-py2/"),
120    ("use-apt", "/en/use-apt/"),
121    ("update-conda-startup", "/en/update-conda-startup/"),
122    ("unicode-filename", "/en/unicode-filename/"),
123    ("d--branch", "/en/d--branch/"),
124    ("ubuntu-22.04", "/en/ubuntu-22.04/"),
125    ("ubuntu-20.04-python-3.9", "/en/ubuntu-20.04-python-3.9/"),
126    ("ubuntu-20.04", "/en/ubuntu-20.04/"),
127    ("typlog-theme", "/en/typlog-theme/"),
128    ("timetestlarge", "/en/timetestlarge/"),
129    ("timetest", "/en/timetest/"),
130    ("timeout", "/en/timeout/"),
131    ("throw-exception", "/en/throw-exception/"),
132    ("test-ubuntu-20.04", "/en/test-ubuntu-20.04/"),
133    ("test-paths-with-spaces", "/en/test-paths-with-spaces/"),
134    ("test-parent-path-error", "/en/test-parent-path-error/"),
135    ("testing-activate-version", "/en/testing-activate-version/"),
136    ("test-auto-cancel", "/en/test-auto-cancel/"),
137    ("template-config-file", "/en/template-config-file/"),
138    ("sudo-commands", "/en/sudo-commands/"),
139    ("submodule-not-found", "/en/submodule-not-found/"),
140    ("submodule-https-scheme", "/en/submodule-https-scheme/"),
141    ("submodule-git-scheme", "/en/submodule-git-scheme/"),
142    ("staticrypt", "/en/staticrypt/"),
143    ("sphinx-tectonic-pdf", "/en/sphinx-tectonic-pdf/"),
144    ("sphinx-tabs", "/en/sphinx-tabs/"),
145    ("sphinx-multipage-html", "/en/sphinx-multipage-html/"),
146    ("sphinx-mkdocstrings", "/en/sphinx-mkdocstrings/"),
147    ("sphinx-latest", "/en/sphinx-latest/"),
148    ("sphinx-hoverxref", "/en/sphinx-hoverxref/"),
149    ("sphinx.ext.duration", "/en/sphinx.ext.duration/"),
150    ("sphinx-es-suggest", "/en/sphinx-es-suggest/"),
151    ("sphinx-docs-zundler", "/en/sphinx-docs-zundler/"),
152    ("sphinx-conf-nonstandard", "/en/sphinx-conf-nonstandard/"),
153    ("sphinx-awesome", "/en/sphinx-awesome/"),
154    ("sphinx-7.0.x", "/en/sphinx-7.0.x/"),
155    ("sphinx6.x-default", "/en/sphinx6.x-default/"),
156    ("sphinx5.x-default-confpy", "/en/sphinx5.x-default-confpy/"),
157    ("sphinx-5.x", "/en/sphinx-5.x/"),
158    ("sphinx-1.8", "/en/sphinx-1.8/"),
159    ("skip-build-command-pr-test3", "/en/skip-build-command-pr-test3/"),
160    ("skip-build-command-pr-test2", "/en/skip-build-command-pr-test2/"),
161    ("skip-build-command-pr-test", "/en/skip-build-command-pr-test/"),
162    ("skip-build-command", "/en/skip-build-command/"),
163    ("singlehtml", "/en/singlehtml/"),
164    ("shot-scraper", "/en/shot-scraper/"),
165    ("search-with-old-sphinx-and-theme", "/en/search-with-old-sphinx-and-theme/"),
166    ("search-special-chars", "/en/search-special-chars/"),
167    ("rust-1.70", "/en/rust-1.70/"),
168    ("rust", "/en/rust/"),
169    ("robots-txt", "/en/robots-txt/"),
170    ("requirements-not-found", "/en/requirements-not-found/"),
171    ("regular-404-page", "/en/regular-404-page/"),
172    ("recommonmark", "/en/recommonmark/"),
173    ("readthedocs-docs-build-commands", "/en/readthedocs-docs-build-commands/"),
174    ("python-setuptools-package", "/en/python-setuptools-package/"),
175    ("pypy3.5", "/en/pypy3.5/"),
176    ("pygments-custom-lexer-apex", "/en/pygments-custom-lexer-apex/"),
177    ("py3.9", "/en/py3.9/"),
178    ("py3.8", "/en/py3.8/"),
179    ("py3.11", "/en/py3.11/"),
180    ("py3.10", "/en/py3.10/"),
181    ("pr-visual-diff", "/en/pr-visual-diff/"),
182    ("pr-test-git-clone-test", "/en/pr-test-git-clone-test/"),
183    ("pr-test", "/en/pr-test/"),
184    ("pr-readthedocs_output", "/en/pr-readthedocs_output/"),
185    ("pr-js-client", "/en/pr-js-client/"),
186    ("pr-homepage-edition", "/en/pr-homepage-edition/"),
187    ("pr-docusaurus", "/en/pr-docusaurus/"),
188    ("poetry-asdf", "/en/poetry-asdf/"),
189    ("poetry", "/en/poetry/"),
190    ("pelican", "/en/pelican/"),
191    ("pdf-rinohtype", "/en/pdf-rinohtype/"),
192    ("pdf-cmd-fail", "/en/pdf-cmd-fail/"),
193    ("path-with-plus", "/en/path-with-plus/"),
194    ("old-output-directory", "/en/old-output-directory/"),
195    ("no-pr-build", "/en/no-pr-build/"),
196    ("no-conf-py", "/en/no-conf-py/"),
197    ("no-config-file", "/en/no-config-file/"),
198    ("nbsphinx-3d-plot", "/en/nbsphinx-3d-plot/"),
199    ("multiple-source-suffix", "/en/multiple-source-suffix/"),
200    ("monorepo", "/en/monorepo/"),
201    ("mkdocs-python-tags", "/en/mkdocs-python-tags/"),
202    ("mkdocs-pdf", "/en/mkdocs-pdf/"),
203    ("mkdocs-material", "/en/mkdocs-material/"),
204    ("mkdocs-htmlzip", "/en/mkdocs-htmlzip/"),
205    ("mkdocs-config-at-root", "/en/mkdocs-config-at-root/"),
206    ("mkdocs", "/en/mkdocs/"),
207    ("meta-tags", "/en/meta-tags/"),
208    ("manual-integrations", "/en/manual-integrations/"),
209    ("manual-integration-docsify", "/en/manual-integration-docsify/"),
210    ("mamba", "/en/mamba/"),
211    ("jupyter-book", "/en/jupyter-book/"),
212    ("jsdoc-autoapi", "/en/jsdoc-autoapi/"),
213    ("jsdoc", "/en/jsdoc/"),
214    ("japanese-pdf", "/en/japanese-pdf/"),
215    ("invalid-submodules", "/en/invalid-submodules/"),
216    ("invalid-docker-image", "/en/invalid-docker-image/"),
217    ("install-setuptools", "/en/install-setuptools/"),
218    ("huge-build-output", "/en/huge-build-output/"),
219    ("htmldir", "/en/htmldir/"),
220    ("git-submodules-invalid", "/en/git-submodules-invalid/"),
221    ("git-submodules", "/en/git-submodules/"),
222    ("git-lfs-build-jobs", "/en/git-lfs-build-jobs/"),
223    ("furo", "/en/furo/"),
224    ("file-with-apostrophe", "/en/file-with-apostrophe/"),
225    ("expose-env-pip-error", "/en/expose-env-pip-error/"),
226    ("explicit-flyout-placement", "/en/explicit-flyout-placement/"),
227    ("envvar-config-file", "/en/envvar-config-file/"),
228    ("environment-variables", "/en/environment-variables/"),
229    ("docusaurus", "/en/docusaurus/"),
230    ("docsify-ads", "/en/docsify-ads/"),
231    ("docsify", "/en/docsify/"),
232    ("datetime", "/en/datetime/"),
233    ("d2lbook", "/en/d2lbook/"),
234    ("custom-404-page", "/en/custom-404-page/"),
235    ("conda-pin-common-deps", "/en/conda-pin-common-deps/"),
236    ("conda-env-py3.7", "/en/conda-env-py3.7/"),
237    ("conda-env-no-py-pinned", "/en/conda-env-no-py-pinned/"),
238    ("conda-env", "/en/conda-env/"),
239    ("c-dependencies", "/en/c-dependencies/"),
240    ("build-tools-mamba", "/en/build-tools-mamba/"),
241    ("build-tools-conda", "/en/build-tools-conda/"),
242    ("build-tools", "/en/build-tools/"),
243    ("build-os-error-message", "/en/build-os-error-message/"),
244    ("build-latest-python-3.8", "/en/build-latest-python-3.8/"),
245    ("build-jobs-spaces-in-command", "/en/build-jobs-spaces-in-command/"),
246    ("build-jobs-post-build", "/en/build-jobs-post-build/"),
247    ("build-jobs-multiline", "/en/build-jobs-multiline/"),
248    ("build-jobs-diff-exit", "/en/build-jobs-diff-exit/"),
249    ("build-jobs", "/en/build-jobs/"),
250    ("build-internals", "/en/build-internals/"),
251    ("build-image", "/en/build-image/"),
252    ("build-commands-multiline", "/en/build-commands-multiline/"),
253    ("build-commands-env-vars", "/en/build-commands-env-vars/"),
254    ("build-commands", "/en/build-commands/"),
255    ("branch-with-slashes", "/en/branch-with-slashes/"),
256    ("bare-commands", "/en/bare-commands/"),
257    ("another-matching-branch", "/en/another-matching-branch/"),
258    ("annotated-tag", "/en/annotated-tag/"),
259    ("all-formats-build-jobs", "/en/all-formats-build-jobs/"),
260    ("all-formats-build-commands", "/en/all-formats-build-commands/"),
261    ("all-formats", "/en/all-formats/"),
262    ("alabaster-theme", "/en/alabaster-theme/"),
263    ],
264    'downloads': [ 
265    ],
266    'subprojects': [ 
267    ],
268    'slug': 'test-builds',
269    'name': u'test-builds',
270    'rtd_language': u'en',
271    'programming_language': u'words',
272    'canonical_url': '',
273    'analytics_code': 'UA-12341234-1',
274    'single_version': False,
275    'conf_py_path': '/docs/',
276    'api_host': 'https://readthedocs.org',
277    'github_user': 'readthedocs',
278    'proxied_api_host': '/_',
279    'github_repo': 'test-builds',
280    'github_version': 'build-image',
281    'display_github': True,
282    'bitbucket_user': 'None',
283    'bitbucket_repo': 'None',
284    'bitbucket_version': 'build-image',
285    'display_bitbucket': False,
286    'gitlab_user': 'None',
287    'gitlab_repo': 'None',
288    'gitlab_version': 'build-image',
289    'display_gitlab': False,
290    'READTHEDOCS': True,
291    'using_theme': (html_theme == "default"),
292    'new_theme': (html_theme == "sphinx_rtd_theme"),
293    'source_suffix': SUFFIX,
294    'ad_free': False,
295    'docsearch_disabled': False,
296    'user_analytics_code': 'UA-12341234-1',
297    'global_analytics_code': None,
298    'commit': '6277820d',
299}
300
301# For sphinx >=1.8 we can use html_baseurl to set the canonical URL.
302# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_baseurl
303if version_info >= (1, 8):
304    if not globals().get('html_baseurl'):
305        html_baseurl = context['canonical_url']
306    context['canonical_url'] = None
307
308
309
310
311
312if 'html_context' in globals():
313    for key in context:
314        if key not in html_context:
315            html_context[key] = context[key]
316else:
317    html_context = context
318
319# Add custom RTD extension
320if 'extensions' in globals():
321    # Insert at the beginning because it can interfere
322    # with other extensions.
323    # See https://github.com/rtfd/readthedocs.org/pull/4054
324    extensions.insert(0, "readthedocs_ext.readthedocs")
325else:
326    extensions = ["readthedocs_ext.readthedocs"]
327
328# Add External version warning banner to the external version documentation
329if 'branch' == 'external':
330    extensions.insert(1, "readthedocs_ext.external_version_warning")
331    readthedocs_vcs_url = 'None'
332    readthedocs_build_url = 'https://readthedocs.org/projects/test-builds/builds/21470622/'
333
334project_language = 'en'
335
336# User's Sphinx configurations
337language_user = globals().get('language', None)
338latex_engine_user = globals().get('latex_engine', None)
339latex_elements_user = globals().get('latex_elements', None)
340
341# Remove this once xindy gets installed in Docker image and XINDYOPS
342# env variable is supported
343# https://github.com/rtfd/readthedocs-docker-images/pull/98
344latex_use_xindy = False
345
346chinese = any([
347    language_user in ('zh_CN', 'zh_TW'),
348    project_language in ('zh_CN', 'zh_TW'),
349])
350
351japanese = any([
352    language_user == 'ja',
353    project_language == 'ja',
354])
355
356if chinese:
357    latex_engine = latex_engine_user or 'xelatex'
358
359    latex_elements_rtd = {
360        'preamble': '\\usepackage[UTF8]{ctex}\n',
361    }
362    latex_elements = latex_elements_user or latex_elements_rtd
363elif japanese:
364    latex_engine = latex_engine_user or 'platex'
365
366# Make sure our build directory is always excluded
367exclude_patterns = globals().get('exclude_patterns', [])
368exclude_patterns.extend(['_build'])