conf.py

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