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