#!/usr/bin/env python3
import os
# 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',
'sphinx_copybutton', # for "copy to clipboard" buttons
'sphinx.ext.mathjax', # for math equations
'sphinxcontrib.bibtex', # for bibliographic references
'sphinxcontrib.rsvgconverter', # for SVG->PDF conversion in LaTeX output
'sphinx_gallery.load_style', # load CSS for gallery (needs SG >= 0.6)
]
# Default language for syntax highlighting in reST and Markdown cells:
highlight_language = 'none'
# Don't add .txt suffix to source files:
html_sourcelink_suffix = ''
# Work-around until https://github.com/sphinx-doc/sphinx/issues/4229 is solved:
html_scaled_image_link = False
# List of arguments to be passed to the kernel that executes the notebooks:
nbsphinx_execute_arguments = [
"--InlineBackend.figure_formats={'svg', 'pdf'}",
"--InlineBackend.rc={'figure.dpi': 96}",
]
# 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': '_static/copy-button.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.}}
"""
mathjax_config = {
'TeX': {'equationNumbers': {'autoNumber': 'AMS', 'useLabelIds': True}},
}
# Additional files needed for generating LaTeX/PDF output:
latex_additional_files = ['references.bib']
# Support for notebook formats other than .ipynb
nbsphinx_custom_formats = {
'.pct.py': ['jupytext.reads', {'fmt': 'py:percent'}],
}
# -- The settings below this line are not specific to nbsphinx ------------
master_doc = 'index'
project = 'nbsphinx'
author = 'Matthias Geier'
copyright = '2020, ' + author
linkcheck_ignore = [r'http://localhost:\d+/']
# -- 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_title = project + ' version ' + release
# -- Options for LaTeX output ---------------------------------------------
# See https://www.sphinx-doc.org/en/master/latex.html
latex_elements = {
'papersize': 'a4paper',
'printindex': '',
'sphinxsetup': r"""
%verbatimwithframe=false,
%verbatimwrapslines=false,
%verbatimhintsturnover=false,
VerbatimColor={HTML}{F5F5F5},
VerbatimBorderColor={HTML}{E0E0E0},
noteBorderColor={HTML}{E0E0E0},
noteborder=1.5pt,
warningBorderColor={HTML}{E0E0E0},
warningborder=1.5pt,
warningBgColor={HTML}{FBFBFB},
""",
'preamble': r"""
\usepackage[sc,osf]{mathpazo}
\linespread{1.05} % see http://www.tug.dk/FontCatalogue/urwpalladio/
\renewcommand{\sfdefault}{pplj} % Palatino instead of sans serif
\IfFileExists{zlmtt.sty}{
\usepackage[light,scaled=1.05]{zlmtt} % light typewriter font from lmodern
}{
\renewcommand{\ttdefault}{lmtt} % typewriter font from lmodern
}
\usepackage{booktabs} % for Pandas dataframes
""",
}
latex_documents = [
(master_doc, 'nbsphinx.tex', project, author, 'howto'),
]
latex_show_urls = 'footnote'
latex_show_pagerefs = True
# -- Options for EPUB output ----------------------------------------------
# These are just defined to avoid Sphinx warnings related to EPUB:
version = release
suppress_warnings = ['epub.unknown_project_files']
###########################################################################
# 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/master/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl
#
import importlib
import sys
import os.path
from six import string_types
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:
theme = importlib.import_module('sphinx_rtd_theme')
html_theme = 'sphinx_rtd_theme'
html_style = None
html_theme_options = {}
if 'html_theme_path' in globals():
html_theme_path.append(theme.get_html_theme_path())
else:
html_theme_path = [theme.get_html_theme_path()]
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': "0.6.1",
'version_slug': "0.6.1",
'MEDIA_URL': "https://media.readthedocs.org/",
'STATIC_URL': "https://assets.readthedocs.org/static/",
'PRODUCTION_DOMAIN': "readthedocs.org",
'versions': [
("latest", "/en/latest/"),
("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/"),
("typlog-theme", "/en/typlog-theme/"),
("traditional-theme", "/en/traditional-theme/"),
("sphinxdoc-theme", "/en/sphinxdoc-theme/"),
("sizzle-theme", "/en/sizzle-theme/"),
("scrolls-theme", "/en/scrolls-theme/"),
("rtd-theme", "/en/rtd-theme/"),
("pyviz-theme", "/en/pyviz-theme/"),
("pytorch-theme", "/en/pytorch-theme/"),
("pyramid-theme", "/en/pyramid-theme/"),
("pydata-theme", "/en/pydata-theme/"),
("py3doc-enhanced-theme", "/en/py3doc-enhanced-theme/"),
("press-theme", "/en/press-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/"),
("julia-theme", "/en/julia-theme/"),
("haiku-theme", "/en/haiku-theme/"),
("guzzle-theme", "/en/guzzle-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/"),
("alabaster-jupyterhub-theme", "/en/alabaster-jupyterhub-theme/"),
("agogo-theme", "/en/agogo-theme/"),
("0.1.0", "/en/0.1.0/"),
],
'downloads': [
("pdf", "//nbsphinx.readthedocs.io/_/downloads/en/0.6.1/pdf/"),
("html", "//nbsphinx.readthedocs.io/_/downloads/en/0.6.1/htmlzip/"),
("epub", "//nbsphinx.readthedocs.io/_/downloads/en/0.6.1/epub/"),
],
'subprojects': [
],
'slug': 'nbsphinx',
'name': u'nbsphinx',
'rtd_language': u'en',
'programming_language': u'py',
'canonical_url': 'https://nbsphinx.readthedocs.io/en/0.6.1/',
'analytics_code': 'None',
'single_version': False,
'conf_py_path': '/doc/',
'api_host': 'https://readthedocs.org',
'proxied_api_host': 'https://readthedocs.org',
'github_user': 'spatialaudio',
'github_repo': 'nbsphinx',
'github_version': '0.6.1',
'display_github': True,
'bitbucket_user': 'None',
'bitbucket_repo': 'None',
'bitbucket_version': '0.6.1',
'display_bitbucket': False,
'gitlab_user': 'None',
'gitlab_repo': 'None',
'gitlab_version': '0.6.1',
'display_gitlab': False,
'READTHEDOCS': True,
'using_theme': (html_theme == "default"),
'new_theme': (html_theme == "sphinx_rtd_theme"),
'source_suffix': SUFFIX,
'ad_free': False,
'user_analytics_code': '',
'global_analytics_code': 'UA-17997319-1',
'commit': '29040721',
}
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 'tag' == 'external':
extensions.insert(1, "readthedocs_ext.external_version_warning")
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'