conf.py

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