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