Browse code

do not inline the HoloViews JS

Bas Nijholt authored on 26/03/2019 12:44:31
Showing 12 changed files
... ...
@@ -14,7 +14,7 @@ _ipywidgets_enabled = False
14 14
 _plotly_enabled = False
15 15
 
16 16
 
17
-def notebook_extension():
17
+def notebook_extension(*, _inline_js=True):
18 18
     """Enable ipywidgets, holoviews, and asyncio notebook integration."""
19 19
     if not in_ipynb():
20 20
         raise RuntimeError('"adaptive.notebook_extension()" may only be run '
... ...
@@ -27,7 +27,7 @@ def notebook_extension():
27 27
         _holoviews_enabled = False  # After closing a notebook the js is gone
28 28
         if not _holoviews_enabled:
29 29
             import holoviews
30
-            holoviews.notebook_extension('bokeh', logo=False)
30
+            holoviews.notebook_extension('bokeh', logo=False, inline=_inline_js)
31 31
             _holoviews_enabled = True
32 32
     except ModuleNotFoundError:
33 33
         warnings.warn("holoviews is not installed; plotting "
... ...
@@ -48,7 +48,7 @@ on the *Play* :fa:`play` button or move the sliders.
48 48
     from adaptive.learner.learner1D import uniform_loss, default_loss
49 49
     import holoviews as hv
50 50
     import numpy as np
51
-    adaptive.notebook_extension()
51
+    adaptive.notebook_extension(_inline_js=False)
52 52
     %output holomap='scrubber'
53 53
 
54 54
 `adaptive.Learner1D`
... ...
@@ -14,7 +14,7 @@ Tutorial `~adaptive.AverageLearner`
14 14
     :hide-code:
15 15
 
16 16
     import adaptive
17
-    adaptive.notebook_extension()
17
+    adaptive.notebook_extension(_inline_js=False)
18 18
 
19 19
 The next type of learner averages a function until the uncertainty in
20 20
 the average meets some condition.
... ...
@@ -14,7 +14,7 @@ Tutorial `~adaptive.BalancingLearner`
14 14
     :hide-code:
15 15
 
16 16
     import adaptive
17
-    adaptive.notebook_extension()
17
+    adaptive.notebook_extension(_inline_js=False)
18 18
 
19 19
     import holoviews as hv
20 20
     import numpy as np
... ...
@@ -14,7 +14,7 @@ Tutorial `~adaptive.DataSaver`
14 14
     :hide-code:
15 15
 
16 16
     import adaptive
17
-    adaptive.notebook_extension()
17
+    adaptive.notebook_extension(_inline_js=False)
18 18
 
19 19
 If the function that you want to learn returns a value along with some
20 20
 metadata, you can wrap your learner in an `adaptive.DataSaver`.
... ...
@@ -14,7 +14,7 @@ Tutorial `~adaptive.IntegratorLearner`
14 14
     :hide-code:
15 15
 
16 16
     import adaptive
17
-    adaptive.notebook_extension()
17
+    adaptive.notebook_extension(_inline_js=False)
18 18
 
19 19
     import holoviews as hv
20 20
     import numpy as np
... ...
@@ -14,7 +14,7 @@ Tutorial `~adaptive.Learner1D`
14 14
     :hide-code:
15 15
 
16 16
     import adaptive
17
-    adaptive.notebook_extension()
17
+    adaptive.notebook_extension(_inline_js=False)
18 18
 
19 19
     import numpy as np
20 20
     from functools import partial
... ...
@@ -14,7 +14,7 @@ Tutorial `~adaptive.Learner2D`
14 14
     :hide-code:
15 15
 
16 16
     import adaptive
17
-    adaptive.notebook_extension()
17
+    adaptive.notebook_extension(_inline_js=False)
18 18
 
19 19
     import numpy as np
20 20
     from functools import partial
... ...
@@ -14,7 +14,7 @@ Tutorial `~adaptive.LearnerND`
14 14
     :hide-code:
15 15
 
16 16
     import adaptive
17
-    adaptive.notebook_extension()
17
+    adaptive.notebook_extension(_inline_js=False)
18 18
 
19 19
     import holoviews as hv
20 20
     import numpy as np
... ...
@@ -14,7 +14,7 @@ Tutorial `~adaptive.SKOptLearner`
14 14
     :hide-code:
15 15
 
16 16
     import adaptive
17
-    adaptive.notebook_extension()
17
+    adaptive.notebook_extension(_inline_js=False)
18 18
 
19 19
     import holoviews as hv
20 20
     import numpy as np
... ...
@@ -14,7 +14,7 @@ Advanced Topics
14 14
     :hide-code:
15 15
 
16 16
     import adaptive
17
-    adaptive.notebook_extension()
17
+    adaptive.notebook_extension(_inline_js=False)
18 18
 
19 19
     import asyncio
20 20
     from functools import partial
... ...
@@ -14,7 +14,7 @@ Custom adaptive logic for 1D and 2D
14 14
     :hide-code:
15 15
 
16 16
     import adaptive
17
-    adaptive.notebook_extension()
17
+    adaptive.notebook_extension(_inline_js=False)
18 18
 
19 19
     # Import modules that are used in multiple cells
20 20
     import numpy as np