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