Skip to content

Commit 987b5f9

Browse files
committed
Merge branch 'tutorial' into 'master'
add tutorials See merge request qt/adaptive!129
2 parents 77ec068 + 76f7f85 commit 987b5f9

22 files changed

Lines changed: 1354 additions & 8 deletions

adaptive/notebook_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def notebook_extension():
2020
try:
2121
import ipywidgets
2222
import holoviews
23-
holoviews.notebook_extension('bokeh')
23+
holoviews.notebook_extension('bokeh', logo=False)
2424
_plotting_enabled = True
2525
except ModuleNotFoundError:
2626
warnings.warn("holoviews and (or) ipywidgets are not installed; plotting "

adaptive/runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ class BlockingRunner(BaseRunner):
264264
of cores available in `executor`.
265265
log : bool, default: False
266266
If True, record the method calls made to the learner by this runner.
267-
shutdown_executor : Bool, default: False
267+
shutdown_executor : bool, default: False
268268
If True, shutdown the executor when the runner has completed. If
269269
`executor` is not provided then the executor created internally
270270
by the runner is shut down, regardless of this parameter.
@@ -367,7 +367,7 @@ class AsyncRunner(BaseRunner):
367367
of cores available in `executor`.
368368
log : bool, default: False
369369
If True, record the method calls made to the learner by this runner.
370-
shutdown_executor : Bool, default: False
370+
shutdown_executor : bool, default: False
371371
If True, shutdown the executor when the runner has completed. If
372372
`executor` is not provided then the executor created internally
373373
by the runner is shut down, regardless of this parameter.

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
build/*
2+
source/_static/holoviews.*

docs/environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ dependencies:
1616
- scikit-optimize
1717
- pip:
1818
- sphinx_rtd_theme
19+
- git+https://github.com/basnijholt/jupyter-sphinx.git@widgets_execute

docs/source/_static/jquery.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// This file is empty because we are already loading jQuery with holoviews in the <head>

docs/source/_templates/layout.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{% extends "!layout.html" %}
2+
{% block extrahead %}
3+
{%- for scriptfile in holoviews_js_files %}
4+
{{ js_tag(scriptfile) }}
5+
{%- endfor %}
6+
{% endblock %}

docs/source/conf.py

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
'sphinx.ext.mathjax',
4848
'sphinx.ext.viewcode',
4949
'sphinx.ext.napoleon',
50+
'jupyter_sphinx.execute',
5051
]
5152

5253
source_parsers = {}
@@ -86,6 +87,7 @@
8687
#
8788
html_theme = 'sphinx_rtd_theme'
8889

90+
8991
# Theme options are theme-specific and customize the look and feel of a theme
9092
# further. For a list of options available for each theme, see the
9193
# documentation.
@@ -113,13 +115,36 @@
113115
# Output file base name for HTML help builder.
114116
htmlhelp_basename = 'adaptivedoc'
115117

118+
116119
# -- Extension configuration -------------------------------------------------
117120

118121
default_role = 'autolink'
119122

120-
intersphinx_mapping = {'python': ('https://docs.python.org/3', None),
121-
'distributed': ('https://distributed.readthedocs.io/en/stable/', None),
122-
'holoviews': ('https://holoviews.org/', None),
123-
'ipyparallel': ('https://ipyparallel.readthedocs.io/en/stable/', None),
124-
'scipy': ('https://docs.scipy.org/doc/scipy/reference', None),
123+
intersphinx_mapping = {
124+
'python': ('https://docs.python.org/3', None),
125+
'distributed': ('https://distributed.readthedocs.io/en/stable/', None),
126+
'holoviews': ('https://holoviews.org/', None),
127+
'ipyparallel': ('https://ipyparallel.readthedocs.io/en/stable/', None),
128+
'scipy': ('https://docs.scipy.org/doc/scipy/reference', None),
125129
}
130+
131+
132+
def get_holoviews_js_css():
133+
from holoviews.plotting import Renderer
134+
dependencies = {**Renderer.core_dependencies,
135+
**Renderer.extra_dependencies}
136+
required = ['jQueryUI', 'jQuery', 'require']
137+
js = [url for name in required for url in dependencies[name].get('js', [])]
138+
css = [url for name in required for url in dependencies[name].get('css', [])]
139+
return js, css
140+
141+
142+
js, css = get_holoviews_js_css()
143+
html_context = {'holoviews_js_files': js}
144+
145+
146+
def setup(app):
147+
for url in css:
148+
app.add_stylesheet(url)
149+
150+
app.add_javascript("https://unpkg.com/@jupyter-widgets/html-manager@0.14.4/dist/embed-amd.js")

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@
1717
:hidden:
1818

1919
rest_of_readme
20+
tutorial/tutorial
2021
reference/adaptive

docs/source/reference/adaptive.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Runners
2222
adaptive.runner.Runner
2323
adaptive.runner.AsyncRunner
2424
adaptive.runner.BlockingRunner
25+
adaptive.runner.extras
2526

2627
Other
2728
-----
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
adaptive.runner.simple
2+
======================
3+
4+
Simple executor
5+
---------------
6+
7+
.. autofunction:: adaptive.runner.simple
8+
9+
Sequential excecutor
10+
--------------------
11+
12+
.. autofunction:: adaptive.runner.SequentialExecutor
13+
14+
15+
Replay log
16+
----------
17+
18+
.. autofunction:: adaptive.runner.replay_log

0 commit comments

Comments
 (0)