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