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': "shot-scraper",
 95    'version_slug': "shot-scraper",
 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    ("shot-scraper", "/en/shot-scraper/"),
147    ("search-with-old-sphinx-and-theme", "/en/search-with-old-sphinx-and-theme/"),
148    ("rust", "/en/rust/"),
149    ("run-rust", "/en/run-rust/"),
150    ("rtd-sphinx-ext", "/en/rtd-sphinx-ext/"),
151    ("robots-txt", "/en/robots-txt/"),
152    ("requirements-not-found", "/en/requirements-not-found/"),
153    ("regular-404-page", "/en/regular-404-page/"),
154    ("recommonmark", "/en/recommonmark/"),
155    ("pypy3.5", "/en/pypy3.5/"),
156    ("pygments-custom-lexer-apex", "/en/pygments-custom-lexer-apex/"),
157    ("py3.9", "/en/py3.9/"),
158    ("py3.8", "/en/py3.8/"),
159    ("py3.5", "/en/py3.5/"),
160    ("py3.11", "/en/py3.11/"),
161    ("py3.10", "/en/py3.10/"),
162    ("pr-visual-diff", "/en/pr-visual-diff/"),
163    ("poetry-asdf", "/en/poetry-asdf/"),
164    ("poetry", "/en/poetry/"),
165    ("pelican", "/en/pelican/"),
166    ("path-with-plus", "/en/path-with-plus/"),
167    ("no-conf-py", "/en/no-conf-py/"),
168    ("no-config-file", "/en/no-config-file/"),
169    ("nbsphinx-3d-plot", "/en/nbsphinx-3d-plot/"),
170    ("multiple-source-suffix", "/en/multiple-source-suffix/"),
171    ("meta-tags", "/en/meta-tags/"),
172    ("mamba", "/en/mamba/"),
173    ("main", "/en/main/"),
174    ("jsdoc-autoapi", "/en/jsdoc-autoapi/"),
175    ("jsdoc", "/en/jsdoc/"),
176    ("japanese-pdf", "/en/japanese-pdf/"),
177    ("invalid-submodules", "/en/invalid-submodules/"),
178    ("install-setuptools", "/en/install-setuptools/"),
179    ("install-pytorch", "/en/install-pytorch/"),
180    ("install-aiohttp", "/en/install-aiohttp/"),
181    ("image", "/en/image/"),
182    ("huge-build-output", "/en/huge-build-output/"),
183    ("htmldir", "/en/htmldir/"),
184    ("hide-me", "/en/hide-me/"),
185    ("git-submodules-invalid", "/en/git-submodules-invalid/"),
186    ("git-submodules", "/en/git-submodules/"),
187    ("git-lfs-build-jobs", "/en/git-lfs-build-jobs/"),
188    ("git-lfs", "/en/git-lfs/"),
189    ("forced-push-tag", "/en/forced-push-tag/"),
190    ("file-with-apostrophe", "/en/file-with-apostrophe/"),
191    ("expose-env-pip-error", "/en/expose-env-pip-error/"),
192    ("explicit-flyout-placement", "/en/explicit-flyout-placement/"),
193    ("environment-variables", "/en/environment-variables/"),
194    ("docsify-ads", "/en/docsify-ads/"),
195    ("docsify", "/en/docsify/"),
196    ("datetime", "/en/datetime/"),
197    ("d2lbook", "/en/d2lbook/"),
198    ("custom-404-page", "/en/custom-404-page/"),
199    ("conda-satisfied-skip-solve", "/en/conda-satisfied-skip-solve/"),
200    ("conda-pin-common-deps", "/en/conda-pin-common-deps/"),
201    ("conda-env-py3.7", "/en/conda-env-py3.7/"),
202    ("conda-env-no-py-pinned", "/en/conda-env-no-py-pinned/"),
203    ("conda-env", "/en/conda-env/"),
204    ("code-injection-3", "/en/code-injection-3/"),
205    ("c-dependencies", "/en/c-dependencies/"),
206    ("build-tools-update-2", "/en/build-tools-update-2/"),
207    ("build-tools-mamba", "/en/build-tools-mamba/"),
208    ("build-tools-conda", "/en/build-tools-conda/"),
209    ("build-tools", "/en/build-tools/"),
210    ("build-os-error-message", "/en/build-os-error-message/"),
211    ("build-jobs-spaces-in-command", "/en/build-jobs-spaces-in-command/"),
212    ("build-jobs-multiline", "/en/build-jobs-multiline/"),
213    ("build-jobs-diff-exit", "/en/build-jobs-diff-exit/"),
214    ("build-jobs", "/en/build-jobs/"),
215    ("build-internals", "/en/build-internals/"),
216    ("build-commands-env-vars", "/en/build-commands-env-vars/"),
217    ("build-commands", "/en/build-commands/"),
218    ("be-default", "/en/be-default/"),
219    ("another-matching-branch", "/en/another-matching-branch/"),
220    ("annotated-tag", "/en/annotated-tag/"),
221    ("all-formats", "/en/all-formats/"),
222    ("alabaster-theme", "/en/alabaster-theme/"),
223    ("agj-test-pr", "/en/agj-test-pr/"),
224    ("agj-rtd-tf-example", "/en/agj-rtd-tf-example/"),
225    ],
226    'downloads': [ 
227    ],
228    'subprojects': [ 
229    ],
230    'slug': 'test-builds',
231    'name': u'test-builds',
232    'rtd_language': u'en',
233    'programming_language': u'words',
234    'canonical_url': 'https://test-builds.readthedocs.io/en/latest/',
235    'analytics_code': 'UA-12341234-1',
236    'single_version': False,
237    'conf_py_path': '/docs/',
238    'api_host': 'https://readthedocs.org',
239    'github_user': 'readthedocs',
240    'proxied_api_host': '/_',
241    'github_repo': 'test-builds',
242    'github_version': 'shot-scraper',
243    'display_github': True,
244    'bitbucket_user': 'None',
245    'bitbucket_repo': 'None',
246    'bitbucket_version': 'shot-scraper',
247    'display_bitbucket': False,
248    'gitlab_user': 'None',
249    'gitlab_repo': 'None',
250    'gitlab_version': 'shot-scraper',
251    'display_gitlab': False,
252    'READTHEDOCS': True,
253    'using_theme': (html_theme == "default"),
254    'new_theme': (html_theme == "sphinx_rtd_theme"),
255    'source_suffix': SUFFIX,
256    'ad_free': False,
257    'docsearch_disabled': False,
258    'user_analytics_code': 'UA-12341234-1',
259    'global_analytics_code': None,
260    'commit': '90d5e709',
261}
262
263# For sphinx >=1.8 we can use html_baseurl to set the canonical URL.
264# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_baseurl
265if version_info >= (1, 8):
266    if not globals().get('html_baseurl'):
267        html_baseurl = context['canonical_url']
268    context['canonical_url'] = None
269
270
271
272
273
274if 'html_context' in globals():
275    
276    html_context.update(context)
277    
278else:
279    html_context = context
280
281# Add custom RTD extension
282if 'extensions' in globals():
283    # Insert at the beginning because it can interfere
284    # with other extensions.
285    # See https://github.com/rtfd/readthedocs.org/pull/4054
286    extensions.insert(0, "readthedocs_ext.readthedocs")
287else:
288    extensions = ["readthedocs_ext.readthedocs"]
289
290# Add External version warning banner to the external version documentation
291if 'branch' == 'external':
292    extensions.insert(1, "readthedocs_ext.external_version_warning")
293    readthedocs_vcs_url = 'None'
294    readthedocs_build_url = 'https://readthedocs.org/projects/test-builds/builds/18386738/'
295
296project_language = 'en'
297
298# User's Sphinx configurations
299language_user = globals().get('language', None)
300latex_engine_user = globals().get('latex_engine', None)
301latex_elements_user = globals().get('latex_elements', None)
302
303# Remove this once xindy gets installed in Docker image and XINDYOPS
304# env variable is supported
305# https://github.com/rtfd/readthedocs-docker-images/pull/98
306latex_use_xindy = False
307
308chinese = any([
309    language_user in ('zh_CN', 'zh_TW'),
310    project_language in ('zh_CN', 'zh_TW'),
311])
312
313japanese = any([
314    language_user == 'ja',
315    project_language == 'ja',
316])
317
318if chinese:
319    latex_engine = latex_engine_user or 'xelatex'
320
321    latex_elements_rtd = {
322        'preamble': '\\usepackage[UTF8]{ctex}\n',
323    }
324    latex_elements = latex_elements_user or latex_elements_rtd
325elif japanese:
326    latex_engine = latex_engine_user or 'platex'
327
328# Make sure our build directory is always excluded
329exclude_patterns = globals().get('exclude_patterns', [])
330exclude_patterns.extend(['_build'])