import os
# You can use sphinx-quickstart to create your own conf.py file!
# After that, you have to edit a few things. See below.
# Select nbsphinx and, if needed, other Sphinx extensions:
extensions = [
'nbsphinx',
'sphinxcontrib.bibtex', # for bibliographic references
'sphinxcontrib.rsvgconverter', # for SVG->PDF conversion in LaTeX output
'sphinx_last_updated_by_git', # get "last updated" from Git
'sphinx_codeautolink', # automatic links from code to documentation
'sphinx.ext.intersphinx', # links to other Sphinx projects (e.g. NumPy)
]
# These projects are also used for the sphinx_codeautolink extension:
intersphinx_mapping = {
'IPython': ('https://ipython.readthedocs.io/en/stable/', None),
'matplotlib': ('https://matplotlib.org/', None),
'numpy': ('https://docs.scipy.org/doc/numpy/', None),
'pandas': ('https://pandas.pydata.org/docs/', None),
'python': ('https://docs.python.org/3/', None),
}
# Don't add .txt suffix to source files:
html_sourcelink_suffix = ''
# List of arguments to be passed to the kernel that executes the notebooks:
nbsphinx_execute_arguments = [
"--InlineBackend.figure_formats={'svg', 'pdf'}",
]
# Environment variables to be passed to the kernel:
os.environ['MY_DUMMY_VARIABLE'] = 'Hello from conf.py!'
nbsphinx_thumbnails = {
'gallery/thumbnail-from-conf-py': 'gallery/a-local-file.png',
'gallery/*-rst': 'images/notebook_icon.png',
'orphan': '_static/favicon.svg',
}
# This is processed by Jinja2 and inserted before each notebook
nbsphinx_prolog = r"""
{% set docname = 'doc/' + env.doc2path(env.docname, base=None) %}
.. raw:: html
This page was generated from
{{ docname|e }}.
Interactive online version:
.
.. raw:: latex
\nbsphinxstartnotebook{\scriptsize\noindent\strut
\textcolor{gray}{The following section was generated from
\sphinxcode{\sphinxupquote{\strut {{ docname | escape_latex }}}} \dotfill}}
"""
# This is processed by Jinja2 and inserted after each notebook
nbsphinx_epilog = r"""
{% set docname = 'doc/' + env.doc2path(env.docname, base=None) %}
.. raw:: latex
\nbsphinxstopnotebook{\scriptsize\noindent\strut
\textcolor{gray}{\dotfill\ \sphinxcode{\sphinxupquote{\strut
{{ docname | escape_latex }}}} ends here.}}
"""
mathjax3_config = {
'tex': {'tags': 'ams', 'useLabelIds': True},
}
# https://sphinxcontrib-bibtex.readthedocs.io/en/latest/usage.html
bibtex_bibfiles = ['references.bib']
bibtex_reference_style = 'author_year'
# Support for notebook formats other than .ipynb
nbsphinx_custom_formats = {
'.pct.py': ['jupytext.reads', {'fmt': 'py:percent'}],
'.md': ['jupytext.reads', {'fmt': 'Rmd'}],
}
# Import Matplotlib to avoid this message in notebooks:
# "Matplotlib is building the font cache; this may take a moment."
import matplotlib.pyplot
# -- The settings below this line are not specific to nbsphinx ------------
master_doc = 'index'
project = 'nbsphinx'
author = 'Matthias Geier'
copyright = '2020, ' + author
html_show_copyright = False
linkcheck_ignore = [
r'http://localhost:\d+/',
'https://github.com/spatialaudio/nbsphinx/compare/',
# 418 Client Error: Unknown for url: https://ieeexplore.ieee.org/document/5582063/
'https://doi.org/10.1109/MCSE.2010.119',
]
nitpicky = True
# -- Get version information and date from Git ----------------------------
try:
from subprocess import check_output
release = check_output(['git', 'describe', '--tags', '--always'])
release = release.decode().strip()
today = check_output(['git', 'show', '-s', '--format=%ad', '--date=short'])
today = today.decode().strip()
except Exception:
release = ''
today = ''
# -- Options for HTML output ----------------------------------------------
html_favicon = 'favicon.svg'
html_title = project + ' version ' + release
html_theme = 'sphinx_rtd_theme'
html_theme_options = {
'navigation_with_keys': True,
'collapse_navigation': False,
}
# -- Options for LaTeX output ---------------------------------------------
# See https://www.sphinx-doc.org/en/master/latex.html
latex_elements = {
'papersize': 'a4paper',
'printindex': '',
'sphinxsetup': r"""
HeaderFamily=\rmfamily\bfseries,
div.note_border-TeXcolor={HTML}{E0E0E0},
div.note_border-width=0.5pt,
div.note_box-decoration-break=slice,
div.warning_border-TeXcolor={HTML}{E0E0E0},
div.warning_border-width=1.5pt,
div.warning_background-TeXcolor={HTML}{FBFBFB},
div.warning_box-decoration-break=slice,
div.topic_box-shadow=none,
div.topic_border-TeXcolor={HTML}{E0E0E0},
div.topic_border-width=0.5pt,
div.topic_box-decoration-break=slice,
""",
'fontpkg': r"""
\usepackage{mathpazo}
\linespread{1.05} % see http://www.tug.dk/FontCatalogue/urwpalladio/
\setmainfont{TeX Gyre Pagella}[Numbers=OldStyle]
\setmonofont{Latin Modern Mono Light}[Numbers=Lining]
""",
'preamble': r"""
\urlstyle{tt}
""",
}
latex_engine = 'lualatex'
latex_use_xindy = False
latex_table_style = ['booktabs']
latex_documents = [
(master_doc, 'nbsphinx.tex', project, author, 'howto'),
]
latex_show_urls = 'footnote'
latex_show_pagerefs = True
# -- Work-around to get LaTeX References at the same place as HTML --------
# See https://github.com/mcmtroffaes/sphinxcontrib-bibtex/issues/156
import sphinx.builders.latex.transforms
class DummyTransform(sphinx.builders.latex.transforms.BibliographyTransform):
def run(self, **kwargs):
pass
sphinx.builders.latex.transforms.BibliographyTransform = DummyTransform
# -- Options for EPUB output ----------------------------------------------
# These are just defined to avoid Sphinx warnings related to EPUB:
version = release
suppress_warnings = ['epub.unknown_project_files']
# -- Set default HTML theme (if none was given above) ---------------------
if 'html_theme' not in globals():
try:
import insipid_sphinx_theme
except ImportError:
pass
else:
html_theme = 'insipid'
html_copy_source = False
html_permalinks_icon = '#'
if globals().get('html_theme') == 'insipid':
# This controls optional content in index.rst:
tags.add('insipid')
###########################################################################
# auto-created readthedocs.org specific configuration #
###########################################################################
#
# The following code was added during an automated build on readthedocs.org
# It is auto created and injected for every build. The result is based on the
# conf.py.tmpl file found in the readthedocs.org codebase:
# https://github.com/rtfd/readthedocs.org/blob/main/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl
#
# Note: this file shouldn't rely on extra dependencies.
import importlib
import sys
import os.path
# Borrowed from six.
PY3 = sys.version_info[0] == 3
string_types = str if PY3 else basestring
from sphinx import version_info
# Get suffix for proper linking to GitHub
# This is deprecated in Sphinx 1.3+,
# as each page can have its own suffix
if globals().get('source_suffix', False):
if isinstance(source_suffix, string_types):
SUFFIX = source_suffix
elif isinstance(source_suffix, (list, tuple)):
# Sphinx >= 1.3 supports list/tuple to define multiple suffixes
SUFFIX = source_suffix[0]
elif isinstance(source_suffix, dict):
# Sphinx >= 1.8 supports a mapping dictionary for multiple suffixes
SUFFIX = list(source_suffix.keys())[0] # make a ``list()`` for py2/py3 compatibility
else:
# default to .rst
SUFFIX = '.rst'
else:
SUFFIX = '.rst'
# Add RTD Static Path. Add to the end because it overwrites previous files.
if not 'html_static_path' in globals():
html_static_path = []
if os.path.exists('_static'):
html_static_path.append('_static')
# Add RTD Theme only if they aren't overriding it already
using_rtd_theme = (
(
'html_theme' in globals() and
html_theme in ['default'] and
# Allow people to bail with a hack of having an html_style
'html_style' not in globals()
) or 'html_theme' not in globals()
)
if using_rtd_theme:
html_theme = 'sphinx_rtd_theme'
html_style = None
html_theme_options = {}
# This following legacy behavior will gradually be sliced out until its deprecated and removed.
# Skipped for Sphinx 6+
# Skipped by internal Feature flag SKIP_SPHINX_HTML_THEME_PATH
# Skipped by all new projects since SKIP_SPHINX_HTML_THEME_PATH's introduction (jan 2023)
if (
using_rtd_theme
and version_info < (6,0)
and not False
):
theme = importlib.import_module('sphinx_rtd_theme')
if 'html_theme_path' in globals():
html_theme_path.append(theme.get_html_theme_path())
else:
html_theme_path = [theme.get_html_theme_path()]
# Define websupport2_base_url and websupport2_static_url
if globals().get('websupport2_base_url', False):
websupport2_base_url = 'https://readthedocs.org/websupport'
websupport2_static_url = 'https://assets.readthedocs.org/static/'
#Add project information to the template context.
context = {
'using_theme': using_rtd_theme,
'html_theme': html_theme,
'current_version': "rtd-theme",
'version_slug': "rtd-theme",
'MEDIA_URL': "https://media.readthedocs.org/",
'STATIC_URL': "https://assets.readthedocs.org/static/",
'PRODUCTION_DOMAIN': "readthedocs.org",
'proxied_static_path': "/_/static/",
'versions': [
("latest", "/en/latest/"),
("0.9.2", "/en/0.9.2/"),
("0.9.1", "/en/0.9.1/"),
("0.9.0", "/en/0.9.0/"),
("0.8.12", "/en/0.8.12/"),
("0.8.11", "/en/0.8.11/"),
("0.8.10", "/en/0.8.10/"),
("0.8.9", "/en/0.8.9/"),
("0.8.8", "/en/0.8.8/"),
("0.8.7", "/en/0.8.7/"),
("0.8.6", "/en/0.8.6/"),
("0.8.5", "/en/0.8.5/"),
("0.8.4", "/en/0.8.4/"),
("0.8.3", "/en/0.8.3/"),
("0.8.2", "/en/0.8.2/"),
("0.8.1", "/en/0.8.1/"),
("0.8.0", "/en/0.8.0/"),
("0.7.1", "/en/0.7.1/"),
("0.7.0", "/en/0.7.0/"),
("0.6.1", "/en/0.6.1/"),
("0.6.0", "/en/0.6.0/"),
("0.5.1", "/en/0.5.1/"),
("0.5.0", "/en/0.5.0/"),
("0.4.3", "/en/0.4.3/"),
("0.4.2", "/en/0.4.2/"),
("0.4.1", "/en/0.4.1/"),
("0.3.5", "/en/0.3.5/"),
("0.3.4", "/en/0.3.4/"),
("0.3.3", "/en/0.3.3/"),
("0.3.2", "/en/0.3.2/"),
("0.3.1", "/en/0.3.1/"),
("0.3.0", "/en/0.3.0/"),
("0.2.18", "/en/0.2.18/"),
("0.2.17", "/en/0.2.17/"),
("0.2.16", "/en/0.2.16/"),
("0.2.15", "/en/0.2.15/"),
("0.2.14", "/en/0.2.14/"),
("0.2.13", "/en/0.2.13/"),
("0.2.12", "/en/0.2.12/"),
("0.2.11", "/en/0.2.11/"),
("0.2.10", "/en/0.2.10/"),
("0.2.9", "/en/0.2.9/"),
("0.2.8", "/en/0.2.8/"),
("0.2.7", "/en/0.2.7/"),
("0.2.6", "/en/0.2.6/"),
("0.2.5", "/en/0.2.5/"),
("0.2.4", "/en/0.2.4/"),
("0.2.3", "/en/0.2.3/"),
("0.2.2", "/en/0.2.2/"),
("0.2.1", "/en/0.2.1/"),
("0.2.0", "/en/0.2.0/"),
("uedoc-theme", "/en/uedoc-theme/"),
("typlog-theme", "/en/typlog-theme/"),
("traditional-theme", "/en/traditional-theme/"),
("sphinxdoc-theme", "/en/sphinxdoc-theme/"),
("sphinx-book-theme", "/en/sphinx-book-theme/"),
("sizzle-theme", "/en/sizzle-theme/"),
("scrolls-theme", "/en/scrolls-theme/"),
("save-rst", "/en/save-rst/"),
("rtd-theme", "/en/rtd-theme/"),
("pyviz-theme", "/en/pyviz-theme/"),
("pytorch-theme", "/en/pytorch-theme/"),
("python-docs-theme", "/en/python-docs-theme/"),
("pyramid-theme", "/en/pyramid-theme/"),
("pydata-theme", "/en/pydata-theme/"),
("py3doc-enhanced-theme", "/en/py3doc-enhanced-theme/"),
("pangeo-theme", "/en/pangeo-theme/"),
("pandas-theme", "/en/pandas-theme/"),
("nature-theme", "/en/nature-theme/"),
("material-theme", "/en/material-theme/"),
("maisie-theme", "/en/maisie-theme/"),
("jupyter-theme", "/en/jupyter-theme/"),
("insipid-theme", "/en/insipid-theme/"),
("immaterial-theme", "/en/immaterial-theme/"),
("holoviz-theme", "/en/holoviz-theme/"),
("haiku-theme", "/en/haiku-theme/"),
("guzzle-theme", "/en/guzzle-theme/"),
("furo-theme", "/en/furo-theme/"),
("documatt-theme", "/en/documatt-theme/"),
("dask-theme", "/en/dask-theme/"),
("cloud-theme", "/en/cloud-theme/"),
("classic-theme", "/en/classic-theme/"),
("bootstrap-theme", "/en/bootstrap-theme/"),
("bizstyle-theme", "/en/bizstyle-theme/"),
("better-theme", "/en/better-theme/"),
("basicstrap-theme", "/en/basicstrap-theme/"),
("astropy-theme", "/en/astropy-theme/"),
("alabaster-theme", "/en/alabaster-theme/"),
("agogo-theme", "/en/agogo-theme/"),
("0.1.0", "/en/0.1.0/"),
],
'downloads': [
("pdf", "//nbsphinx.readthedocs.io/_/downloads/en/rtd-theme/pdf/"),
("html", "//nbsphinx.readthedocs.io/_/downloads/en/rtd-theme/htmlzip/"),
("epub", "//nbsphinx.readthedocs.io/_/downloads/en/rtd-theme/epub/"),
],
'subprojects': [
],
'slug': 'nbsphinx',
'name': u'nbsphinx',
'rtd_language': u'en',
'programming_language': u'py',
'canonical_url': 'https://nbsphinx.readthedocs.io/en/0.9.1/',
'analytics_code': 'None',
'single_version': False,
'conf_py_path': '/doc/',
'api_host': 'https://readthedocs.org',
'github_user': 'spatialaudio',
'proxied_api_host': '/_',
'github_repo': 'nbsphinx',
'github_version': 'rtd-theme',
'display_github': True,
'bitbucket_user': 'None',
'bitbucket_repo': 'None',
'bitbucket_version': 'rtd-theme',
'display_bitbucket': False,
'gitlab_user': 'None',
'gitlab_repo': 'None',
'gitlab_version': 'rtd-theme',
'display_gitlab': False,
'READTHEDOCS': True,
'using_theme': (html_theme == "default"),
'new_theme': (html_theme == "sphinx_rtd_theme"),
'source_suffix': SUFFIX,
'ad_free': False,
'docsearch_disabled': False,
'user_analytics_code': '',
'global_analytics_code': None,
'commit': 'a94110be',
}
# For sphinx >=1.8 we can use html_baseurl to set the canonical URL.
# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_baseurl
if version_info >= (1, 8):
if not globals().get('html_baseurl'):
html_baseurl = context['canonical_url']
context['canonical_url'] = None
if 'html_context' in globals():
html_context.update(context)
else:
html_context = context
# Add custom RTD extension
if 'extensions' in globals():
# Insert at the beginning because it can interfere
# with other extensions.
# See https://github.com/rtfd/readthedocs.org/pull/4054
extensions.insert(0, "readthedocs_ext.readthedocs")
else:
extensions = ["readthedocs_ext.readthedocs"]
# Add External version warning banner to the external version documentation
if 'branch' == 'external':
extensions.insert(1, "readthedocs_ext.external_version_warning")
readthedocs_vcs_url = 'None'
readthedocs_build_url = 'https://readthedocs.org/projects/nbsphinx/builds/20815957/'
project_language = 'en'
# User's Sphinx configurations
language_user = globals().get('language', None)
latex_engine_user = globals().get('latex_engine', None)
latex_elements_user = globals().get('latex_elements', None)
# Remove this once xindy gets installed in Docker image and XINDYOPS
# env variable is supported
# https://github.com/rtfd/readthedocs-docker-images/pull/98
latex_use_xindy = False
chinese = any([
language_user in ('zh_CN', 'zh_TW'),
project_language in ('zh_CN', 'zh_TW'),
])
japanese = any([
language_user == 'ja',
project_language == 'ja',
])
if chinese:
latex_engine = latex_engine_user or 'xelatex'
latex_elements_rtd = {
'preamble': '\\usepackage[UTF8]{ctex}\n',
}
latex_elements = latex_elements_user or latex_elements_rtd
elif japanese:
latex_engine = latex_engine_user or 'platex'
# Make sure our build directory is always excluded
exclude_patterns = globals().get('exclude_patterns', [])
exclude_patterns.extend(['_build'])