Skip to content

Commit a4fe5af

Browse files
committed
tweaked just L78 for main as version issue
1 parent c633a98 commit a4fe5af

File tree

1 file changed

+123
-56
lines changed

1 file changed

+123
-56
lines changed

docs/conf.py

Lines changed: 123 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
# -*- coding: utf-8 -*-
22
#
33
# Configuration file for the Sphinx documentation builder.
4+
#
5+
# This file does only contain a selection of the most common options. For a
6+
# full list see the documentation:
7+
# http://www.sphinx-doc.org/en/master/config
48

59
# -- Path setup --------------------------------------------------------------
610

11+
# If extensions (or modules to document with autodoc) are in another directory,
12+
# add these directories to sys.path here. If the directory is relative to the
13+
# documentation root, use os.path.abspath to make it absolute, like shown here.
14+
#
715
import os
816
import sys
917
import sphinx_rtd_theme
1018

19+
20+
21+
22+
1123
# -- Project information -----------------------------------------------------
1224

1325
project = 'Thermobar'
@@ -17,162 +29,217 @@
1729
# The short X.Y version
1830
version = ''
1931
# The full version, including alpha/beta/rc tags
20-
release = 'v.0'
32+
release = '0'
33+
2134

2235
# If extensions (or modules to document with autodoc) are in another directory,
23-
# add these directories to sys.path here.
36+
# add these directories to sys.path here. If the directory is relative to the
37+
# documentation root, use os.path.abspath to make it absolute, like shown here.
2438
sys.path.insert(0, os.path.abspath('..'))
2539

2640
# -- General configuration ---------------------------------------------------
2741

28-
extensions = [
29-
"sphinx_rtd_theme",
42+
# If your documentation needs a minimal Sphinx version, state it here.
43+
#
44+
# needs_sphinx = '1.0'
45+
46+
# Add any Sphinx extension module names here, as strings. They can be
47+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
48+
# ones.
49+
extensions = ["sphinx_rtd_theme",
3050
'sphinx.ext.autodoc',
3151
'sphinx.ext.autosummary',
3252
'sphinx.ext.intersphinx',
53+
#'sphinx.ext.pngmath',\
3354
'sphinx.ext.napoleon',
3455
'sphinx.ext.mathjax',
3556
'sphinx.ext.viewcode',
3657
'IPython.sphinxext.ipython_directive',
3758
'IPython.sphinxext.ipython_console_highlighting',
59+
#'numpydoc',
3860
'nbsphinx',
3961
'sphinx.ext.viewcode',
4062
'sphinxcontrib.bibtex',
4163
]
42-
43-
bibtex_bibfiles = ['references.bib']
64+
bibtex_bibfiles=['references.bib']
4465
bibtex_reference_style = 'author_year'
4566

46-
# --- RTD / GitHub context for nbsphinx links --------------------------------
4767

48-
on_rtd = os.environ.get('READTHEDOCS', '') == 'True'
4968

50-
# Use the actual ref RTD is building (branch/tag/commit),
51-
# fall back to 'main' when building locally.
52-
github_ref = os.environ.get('READTHEDOCS_GIT_IDENTIFIER', 'main') if on_rtd else 'main'
69+
## Erics nb sphinx
5370

54-
html_context = {
55-
'READTHEDOCS': on_rtd,
56-
'github_version': github_ref,
57-
}
71+
# This is processed by Jinja2 and inserted before each notebook
72+
# Some change in dependencies made us need to replace `var` with
73+
# `env.config.html_context['var']`.
5874

59-
# --- nbsphinx prolog (adds the banner + buttons) ----------------------------
6075

6176
nbsphinx_prolog = r"""
62-
{% set docname = 'docs/' + env.doc2path(env.docname, base=None) %}
63-
{% set git_ref = env.config.html_context.get('github_version', 'main') %}
77+
{% set docname = 'docs' / env.doc2path(env.docname, base=None) %}
78+
{% set git_ref = 'main' %}
6479
6580
.. raw:: html
6681
6782
<div class="admonition note">
68-
<p>
69-
This page was generated from
70-
<a class="reference external"
71-
href="https://github.com/PennyWieser/Thermobar/blob/{{ git_ref|e }}/{{ docname|e }}">
72-
{{ docname|e }}
73-
</a>.
74-
</p>
75-
<p>
76-
Interactive online version:
77-
<a class="reference external"
78-
href="https://mybinder.org/v2/gh/PennyWieser/Thermobar/{{ git_ref|e }}?filepath={{ docname|e }}">
79-
<img alt="Binder badge"
80-
src="https://mybinder.org/badge_logo.svg"
81-
style="vertical-align:text-bottom">
82-
</a>
83-
</p>
84-
<p>
85-
<a class="reference download internal" download=""
86-
href="https://github.com/PennyWieser/Thermobar/raw/{{ git_ref|e }}/{{ docname|e }}">
87-
<code class="xref download docutils literal notranslate">
88-
<span class="pre">Python</span>
89-
<span class="pre">Notebook</span>
90-
<span class="pre">Download</span>
91-
</code>
92-
</a>
83+
<p>This page was generated from
84+
<a class="reference external" href="https://github.com/PennyWieser/Thermobar/blob/{{ git_ref|e }}/{{ docname|e }}">{{ docname|e }}</a>.
85+
86+
Interactive online version:
87+
<a href="https://mybinder.org/v2/gh/PennyWieser/Thermobar/{{ git_ref|e }}?filepath={{ docname|e }}"><img alt="Binder badge" src="https://mybinder.org/badge_logo.svg" style="vertical-align:text-bottom"></a>.
88+
</p>
89+
<p>
90+
<a class="reference download internal" download="" href="https://github.com/PennyWieser/Thermobar/blob/{{ git_ref|e }}/{{ docname|e }}"><code class="xref download docutils literal notranslate"><span class="pre">Python</span> <span class="pre">Notebook</span> <span class="pre">Download</span></code></a>
9391
</p>
9492
<script>
9593
if (document.location.host) {
9694
var p = document.currentScript.previousSibling.previousSibling;
9795
var a = document.createElement('a');
9896
a.innerHTML = 'View in <em>nbviewer</em>';
99-
a.href = 'https://nbviewer.jupyter.org/url' +
100-
(window.location.protocol === 'https:' ? 's/' : '/') +
101-
window.location.host +
102-
window.location.pathname.slice(0, -5) + 'ipynb';
97+
a.href = `https://nbviewer.jupyter.org/url${
98+
(window.location.protocol == 'https:' ? 's/' : '/') +
99+
window.location.host +
100+
window.location.pathname.slice(0, -4) }ipynb`;
103101
a.classList.add('reference');
104102
a.classList.add('external');
105103
p.appendChild(a);
106104
p.appendChild(document.createTextNode('.'));
107105
}
108106
</script>
109107
</div>
110-
111108
.. raw:: latex
112109
113110
\nbsphinxstartnotebook{\scriptsize\noindent\strut
114111
\textcolor{gray}{The following section was generated from
115112
\sphinxcode{\sphinxupquote{\strut {{ docname | escape_latex }}}} \dotfill}}
116113
"""
117114

118-
# -- Templates ----------------------------------------------------------------
119-
115+
# Add any paths that contain templates here, relative to this directory.
120116
templates_path = ['_templates']
121117

122118
# The suffix(es) of source filenames.
119+
# You can specify multiple suffix as a list of string:
120+
#
121+
# source_suffix = ['.rst', '.md']
123122
source_suffix = '.rst'
124123

125124
# The master toctree document.
126125
master_doc = 'index'
127126

128-
# The language for content autogenerated by Sphinx.
127+
# The language for content autogenerated by Sphinx. Refer to documentation
128+
# for a list of supported languages.
129+
#
130+
# This is also used if you do content translation via gettext catalogs.
131+
# Usually you set "language" from the command line for these cases.
129132
language = 'en'
130133

131-
# List of patterns, relative to source directory, to ignore.
134+
# List of patterns, relative to source directory, that match files and
135+
# directories to ignore when looking for source files.
136+
# This pattern also affects html_static_path and html_extra_path .
132137
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
133138

134139
# The name of the Pygments (syntax highlighting) style to use.
135140
pygments_style = 'sphinx'
136141

142+
137143
# -- Options for HTML output -------------------------------------------------
138144

139-
html_theme = "sphinx_rtd_theme"
140-
# html_static_path = ['_static'] # (left commented as in your original)
145+
# The theme to use for HTML and HTML Help pages. See the documentation for
146+
# a list of builtin themes.
147+
#
148+
html_theme = "sphinx_rtd_theme" #'alabaster'
149+
150+
# Theme options are theme-specific and customize the look and feel of a theme
151+
# further. For a list of options available for each theme, see the
152+
# documentation.
153+
#
154+
# html_theme_options = {}
155+
156+
# Add any paths that contain custom static files (such as style sheets) here,
157+
# relative to this directory. They are copied after the builtin static files,
158+
# so a file named "default.css" will overwrite the builtin "default.css".
159+
#html_static_path = ['_static']
160+
161+
# Custom sidebar templates, must be a dictionary that maps document names
162+
# to template names.
163+
#
164+
# The default sidebars (for documents that don't match any pattern) are
165+
# defined by theme itself. Builtin themes are using these templates by
166+
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
167+
# 'searchbox.html']``.
168+
#
169+
# html_sidebars = {}
170+
141171

142172
# -- Options for HTMLHelp output ---------------------------------------------
143173

174+
# Output file base name for HTML help builder.
144175
htmlhelp_basename = 'Thermobardoc'
145176

177+
146178
# -- Options for LaTeX output ------------------------------------------------
147179

148180
latex_elements = {
149-
# Keep your defaults
181+
# The paper size ('letterpaper' or 'a4paper').
182+
#
183+
# 'papersize': 'letterpaper',
184+
185+
# The font size ('10pt', '11pt' or '12pt').
186+
#
187+
# 'pointsize': '10pt',
188+
189+
# Additional stuff for the LaTeX preamble.
190+
#
191+
# 'preamble': '',
192+
193+
# Latex figure (float) alignment
194+
#
195+
# 'figure_align': 'htbp',
150196
}
151197

198+
# Grouping the document tree into LaTeX files. List of tuples
199+
# (source start file, target name, title,
200+
# author, documentclass [howto, manual, or own class]).
152201
latex_documents = [
153202
(master_doc, 'Thermobar.tex', 'Thermobar Documentation',
154203
'Penny Wieser', 'manual'),
155204
]
156205

206+
157207
# -- Options for manual page output ------------------------------------------
158208

209+
# One entry per manual page. List of tuples
210+
# (source start file, name, description, authors, manual section).
159211
man_pages = [
160212
(master_doc, 'Thermobar', 'Thermobar Documentation',
161213
[author], 1)
162214
]
163215

216+
164217
# -- Options for Texinfo output ----------------------------------------------
165218

219+
# Grouping the document tree into Texinfo files. List of tuples
220+
# (source start file, target name, title, author,
221+
# dir menu entry, description, category)
166222
texinfo_documents = [
167223
(master_doc, 'Thermobar', 'Thermobar Documentation',
168224
author, 'Thermobar', 'One line description of project.',
169225
'Miscellaneous'),
170226
]
171227

172-
# -- Intersphinx -------------------------------------------------------------
173228

174229
intersphinx_mapping = {
175230
'python': ('https://docs.python.org/3', None),
176231
'pandas': ('https://pandas.pydata.org/en/latest', None),
177232
'numpy': ('https://docs.scipy.org/doc/numpy', None),
178233
}
234+
235+
236+
237+
html_context = {
238+
'READTHEDOCS': os.environ.get('READTHEDOCS', '') == 'True',
239+
'github_version': os.environ.get('READTHEDOCS_VERSION', 'main'), # Pull correct version info
240+
'current_version': release, # Use release variable defined earlier
241+
}
242+
243+
244+
245+

0 commit comments

Comments
 (0)