Skip to content

Commit 26cdc1e

Browse files
committed
Should fix tests on CI
Signed-off-by: Alexis Jeandet <[email protected]>
1 parent 8a89991 commit 26cdc1e

File tree

4 files changed

+90
-5
lines changed

4 files changed

+90
-5
lines changed

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ docs: ## generate Sphinx HTML documentation, including API docs
7272
$(MAKE) -C docs html
7373
$(BROWSER) docs/_build/html/index.html
7474

75+
doctest:
76+
$(MAKE) -C docs doctest
77+
7578
servedocs: docs ## compile the docs watching for changes
7679
watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .
7780

docs/conf.py

+72-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
#
2020
import os
2121
import sys
22-
sys.path.insert(0, os.path.abspath('..'))
22+
23+
src_path = os.path.abspath('..')
24+
sys.path.insert(0, src_path)
25+
os.environ['PYTHONPATH'] = src_path
2326

2427
import pyistp
2528

@@ -31,7 +34,64 @@
3134

3235
# Add any Sphinx extension module names here, as strings. They can be
3336
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
34-
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
37+
extensions = [
38+
'sphinx.ext.autodoc',
39+
'sphinx.ext.viewcode',
40+
'sphinx.ext.doctest',
41+
'sphinx.ext.intersphinx',
42+
'sphinx.ext.autosectionlabel',
43+
'sphinx_gallery.load_style',
44+
'sphinx_codeautolink',
45+
'sphinxcontrib.apidoc',
46+
'nbsphinx',
47+
'numpydoc']
48+
49+
apidoc_module_dir = '../pyistp'
50+
apidoc_output_dir = 'dev'
51+
apidoc_separate_modules = True
52+
apidoc_module_first = True
53+
54+
55+
autosectionlabel_prefix_document = True
56+
codeautolink_custom_blocks = {
57+
"python3": None,
58+
"pycon3": "sphinx_codeautolink.clean_pycon",
59+
}
60+
61+
nbsphinx_execute_arguments = [
62+
"--InlineBackend.figure_formats={'svg', 'pdf'}",
63+
"--InlineBackend.rc=figure.dpi=96",
64+
]
65+
66+
nbsphinx_execute = 'never'
67+
68+
nbsphinx_thumbnails = {
69+
}
70+
71+
nbsphinx_prolog = r"""
72+
{% set docname = 'docs/' + env.doc2path(env.docname, base=None) %}
73+
{% set nb_base = 'tree' if env.config.revision else 'blob' %}
74+
{% set nb_where = env.config.revision if env.config.revision else 'main' %}
75+
.. raw:: html
76+
<div class="admonition note">
77+
<p style="margin-bottom:0px">
78+
This page was generated by
79+
<a href="https://nbsphinx.readthedocs.io/">nbsphinx</a> from
80+
<a class="reference external" href="https://github.com/SciQLop/speasy/{{ nb_base|e }}/{{ nb_where|e }}/{{ docname|e }}">{{ docname|e }}</a>.
81+
<br>
82+
Interactive online version:
83+
<a href="https://mybinder.org/v2/gh/SciQLop/speasy/{{ nb_where|e }}/?labpath={{ docname|e }}"><img alt="Binder badge" src="https://mybinder.org/badge_logo.svg" style="vertical-align:text-bottom"></a>.
84+
</p>
85+
</div>
86+
.. raw:: latex
87+
\nbsphinxstartnotebook{\scriptsize\noindent\strut
88+
\textcolor{gray}{The following section was generated from
89+
\sphinxcode{\sphinxupquote{\strut {{ docname | escape_latex }}}} \dotfill}}
90+
"""
91+
92+
mathjax3_config = {
93+
'tex': {'tags': 'ams', 'useLabelIds': True},
94+
}
3595

3696
# Add any paths that contain templates here, relative to this directory.
3797
templates_path = ['_templates']
@@ -71,6 +131,8 @@
71131
# This patterns also effect to html_static_path and html_extra_path
72132
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
73133

134+
numpydoc_show_class_members = False
135+
74136
# The name of the Pygments (syntax highlighting) style to use.
75137
pygments_style = 'sphinx'
76138

@@ -83,7 +145,7 @@
83145
# The theme to use for HTML and HTML Help pages. See the documentation for
84146
# a list of builtin themes.
85147
#
86-
html_theme = 'alabaster'
148+
html_theme = 'sphinx_rtd_theme'
87149

88150
# Theme options are theme-specific and customize the look and feel of a
89151
# theme further. For a list of options available for each theme, see the
@@ -159,4 +221,10 @@
159221
]
160222

161223

162-
224+
intersphinx_mapping = {'python3': ('https://docs.python.org/3', None),
225+
'numpy': ('https://numpy.org/doc/stable/', None),
226+
'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None),
227+
'matplotlib': ('https://matplotlib.org/stable/', None),
228+
'seaborn': ('https://seaborn.pydata.org/', None),
229+
'astropy': ('https://docs.astropy.org/en/stable/', None),
230+
}

docs/requirements.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
sphinx-rtd-theme
2+
argh
3+
numpydoc
4+
sphinx-gallery
5+
nbsphinx
6+
ipympl
7+
ipywidgets
8+
sphinx-codeautolink
9+
astropy
10+
pandas
11+
sphinxcontrib-apidoc

tests/test_pyistp.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
from ddt import ddt, data, unpack
77

88
from pyistp import ISTPLoader
9+
import os
10+
11+
current_path = os.path.dirname(__file__)
912

1013
test_data = (
11-
("resources/wi_k0_mfi_20220101_v01.cdf", [
14+
(f"{current_path}/resources/wi_k0_mfi_20220101_v01.cdf", [
1215
"PGSM", "BGSEc", "BF1", "PGSE", "N", "MODE", "BGSMa", "Time_PB5", "DIST", "BGSEa", "BGSMc", "RMS", "DQF",
1316
"Gap_Flag"]),
1417
)

0 commit comments

Comments
 (0)