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': "poetry",
 74    'version_slug': "poetry",
 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-terminal", "/en/mkdocs-terminal/"),
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    ("main", "/en/main/"),
191    ("latest-aliases", "/en/latest-aliases/"),
192    ("jupyter-book", "/en/jupyter-book/"),
193    ("jsdoc-autoapi", "/en/jsdoc-autoapi/"),
194    ("jsdoc", "/en/jsdoc/"),
195    ("jekyll", "/en/jekyll/"),
196    ("japanese-pdf", "/en/japanese-pdf/"),
197    ("invalid-submodules", "/en/invalid-submodules/"),
198    ("invalid-docker-image", "/en/invalid-docker-image/"),
199    ("install-setuptools", "/en/install-setuptools/"),
200    ("humitos-patch-2", "/en/humitos-patch-2/"),
201    ("huge-build-output", "/en/huge-build-output/"),
202    ("htmldir", "/en/htmldir/"),
203    ("git-submodules-invalid", "/en/git-submodules-invalid/"),
204    ("git-submodules", "/en/git-submodules/"),
205    ("git-lfs-build-jobs", "/en/git-lfs-build-jobs/"),
206    ("furo", "/en/furo/"),
207    ("foo", "/en/foo/"),
208    ("file-with-apostrophe", "/en/file-with-apostrophe/"),
209    ("expose-env-pip-error", "/en/expose-env-pip-error/"),
210    ("explicit-flyout-placement", "/en/explicit-flyout-placement/"),
211    ("envvar-config-file", "/en/envvar-config-file/"),
212    ("environment-variables", "/en/environment-variables/"),
213    ("docusaurus", "/en/docusaurus/"),
214    ("docsify-ads", "/en/docsify-ads/"),
215    ("docsify", "/en/docsify/"),
216    ("docdiff-example", "/en/docdiff-example/"),
217    ("datetime", "/en/datetime/"),
218    ("d2lbook", "/en/d2lbook/"),
219    ("custom-404-page", "/en/custom-404-page/"),
220    ("config-file-with-wrong-version-number", "/en/config-file-with-wrong-version-number/"),
221    ("conda-pin-common-deps", "/en/conda-pin-common-deps/"),
222    ("conda-env-py3.7", "/en/conda-env-py3.7/"),
223    ("conda-env-no-py-pinned", "/en/conda-env-no-py-pinned/"),
224    ("conda-env", "/en/conda-env/"),
225    ("conda-build-commands", "/en/conda-build-commands/"),
226    ("c-dependencies", "/en/c-dependencies/"),
227    ("build-tools-mamba", "/en/build-tools-mamba/"),
228    ("build-tools-golang-invalid", "/en/build-tools-golang-invalid/"),
229    ("build-tools-conda", "/en/build-tools-conda/"),
230    ("build-tools", "/en/build-tools/"),
231    ("build-os-error-message", "/en/build-os-error-message/"),
232    ("build-latest-python-3.8", "/en/build-latest-python-3.8/"),
233    ("build-jobs-spaces-in-command", "/en/build-jobs-spaces-in-command/"),
234    ("build-jobs-post-build", "/en/build-jobs-post-build/"),
235    ("build-jobs-multiline", "/en/build-jobs-multiline/"),
236    ("build-jobs-diff-exit", "/en/build-jobs-diff-exit/"),
237    ("build-jobs", "/en/build-jobs/"),
238    ("build-internals", "/en/build-internals/"),
239    ("build-image", "/en/build-image/"),
240    ("build-commands-multiline", "/en/build-commands-multiline/"),
241    ("build-commands-env-vars", "/en/build-commands-env-vars/"),
242    ("build-commands", "/en/build-commands/"),
243    ("branch-with-slashes", "/en/branch-with-slashes/"),
244    ("bare-commands", "/en/bare-commands/"),
245    ("asciidoctor", "/en/asciidoctor/"),
246    ("antora", "/en/antora/"),
247    ("another-matching-branch", "/en/another-matching-branch/"),
248    ("annotated-tag", "/en/annotated-tag/"),
249    ("all-formats-build-jobs", "/en/all-formats-build-jobs/"),
250    ("all-formats-build-commands", "/en/all-formats-build-commands/"),
251    ("all-formats", "/en/all-formats/"),
252    ("alabaster-theme", "/en/alabaster-theme/"),
253    ],
254    'downloads': [ 
255    ],
256    'subprojects': [ 
257    ],
258    'slug': 'test-builds',
259    'name': u'test-builds',
260    'rtd_language': u'en',
261    'programming_language': u'words',
262    'canonical_url': '',
263    'analytics_code': 'UA-12341234-1',
264    'single_version': False,
265    'conf_py_path': '/docs/',
266    'api_host': 'https://readthedocs.org',
267    'github_user': 'readthedocs',
268    'proxied_api_host': '/_',
269    'github_repo': 'test-builds',
270    'github_version': 'poetry',
271    'display_github': True,
272    'bitbucket_user': 'None',
273    'bitbucket_repo': 'None',
274    'bitbucket_version': 'poetry',
275    'display_bitbucket': False,
276    'gitlab_user': 'None',
277    'gitlab_repo': 'None',
278    'gitlab_version': 'poetry',
279    'display_gitlab': False,
280    'READTHEDOCS': True,
281    'using_theme': (html_theme == "default"),
282    'new_theme': (html_theme == "sphinx_rtd_theme"),
283    'source_suffix': SUFFIX,
284    'ad_free': False,
285    'docsearch_disabled': False,
286    'user_analytics_code': 'UA-12341234-1',
287    'global_analytics_code': None,
288    'commit': 'a57d141e',
289}
290
291# For sphinx >=1.8 we can use html_baseurl to set the canonical URL.
292# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_baseurl
293if version_info >= (1, 8):
294    if not globals().get('html_baseurl'):
295        html_baseurl = context['canonical_url']
296    context['canonical_url'] = None
297
298
299
300
301
302if 'html_context' in globals():
303    for key in context:
304        if key not in html_context:
305            html_context[key] = context[key]
306else:
307    html_context = context
308
309# Add custom RTD extension
310if 'extensions' in globals():
311    # Insert at the beginning because it can interfere
312    # with other extensions.
313    # See https://github.com/rtfd/readthedocs.org/pull/4054
314    extensions.insert(0, "readthedocs_ext.readthedocs")
315else:
316    extensions = ["readthedocs_ext.readthedocs"]
317
318# Add External version warning banner to the external version documentation
319if 'branch' == 'external':
320    extensions.insert(1, "readthedocs_ext.external_version_warning")
321    readthedocs_vcs_url = 'None'
322    readthedocs_build_url = 'https://readthedocs.org/projects/test-builds/builds/23729358/'
323
324project_language = 'en'
325
326# User's Sphinx configurations
327language_user = globals().get('language', None)
328latex_engine_user = globals().get('latex_engine', None)
329latex_elements_user = globals().get('latex_elements', None)
330
331# Remove this once xindy gets installed in Docker image and XINDYOPS
332# env variable is supported
333# https://github.com/rtfd/readthedocs-docker-images/pull/98
334latex_use_xindy = False
335
336chinese = any([
337    language_user in ('zh_CN', 'zh_TW'),
338    project_language in ('zh_CN', 'zh_TW'),
339])
340
341japanese = any([
342    language_user == 'ja',
343    project_language == 'ja',
344])
345
346if chinese:
347    latex_engine = latex_engine_user or 'xelatex'
348
349    latex_elements_rtd = {
350        'preamble': '\\usepackage[UTF8]{ctex}\n',
351    }
352    latex_elements = latex_elements_user or latex_elements_rtd
353elif japanese:
354    latex_engine = latex_engine_user or 'platex'
355
356# Make sure our build directory is always excluded
357exclude_patterns = globals().get('exclude_patterns', [])
358exclude_patterns.extend(['_build'])