Repository: bokeh/bokeh

Issue:
Warning: BokehJS previously loaded
Steps to reproduce:
- Create an IPython notebook and display a plot with output_notebook()
- Rerun all cells in the notebook

Now the call to output_notebook will display: “Warning: BokehJS previously loaded” with a red background spanning the entire page. This warning is also visible in exported notebooks.

Calling output_notebook should be idempotent in notebooks. The message “BokehJS successfully loaded.” should also be removed as it adds no useful information (that is what output_notebook does).



Discussion:
output_notebook (hide_banner=True) seems to do the trick. It should be made default or the examples in the getting started guide should use it. These kind of implementation detail warnings have no place in exported documents.

But at least the issue is fixable! Cheers!

I very much doubt we would entertain removing the logo banner by default. It's possible we could change or remove the warning on reload. That dates back to a time when notebook integration was quite a bit more fragile. 

@damianavila It seems that the banner is removed in the notebook when I follow @PetterS 's advice, but when I do a conversion to a Reveal.js presentation it still appears. Thoughts?

@damianavila thoughts one the reload warning? We could remove it entirely, or only show it when `verbose=True` or add a flag specifically to control it. I don't have a strong preference but I think I'd lean towards moving it to show only when `verbose=True`

To be clear, I don't think we should remove the logo banner by default. Contrary to @PetterS I do believe it adds value. It provides an easily, immediately accessible link to the documentation, right there. It also provides a measure of advertising for the project. If that's too much advocacy for an OSS project for someone, it's certainly their prerogative to set `hide_banner=True`.

> @damianavila It seems that the banner is removed in the notebook when I follow @PetterS 's advice, but when I do a conversion to a Reveal.js presentation it still appears. Thoughts?

That's probably because a missing thing in the css of the slides implementation in the notebook, we will fix that soon...

> I don't have a strong preference but I think I'd lean towards moving it to show only when verbose=True

I agree...

> To be clear, I don't think we should remove the logo banner by default

I agree too...


Resolving patch:
diff --git a/bokeh/util/notebook.py b/bokeh/util/notebook.py
--- a/bokeh/util/notebook.py
+++ b/bokeh/util/notebook.py
@@ -51,7 +51,7 @@ def load_notebook(resources=None, verbose=False, hide_banner=False):
 
     warnings = ["Warning: " + msg['text'] for msg in resources.messages if msg['type'] == 'warn']
 
-    if _notebook_loaded:
+    if _notebook_loaded and verbose:
         warnings.append('Warning: BokehJS previously loaded')
 
     _notebook_loaded = resources
@@ -85,4 +85,4 @@ def publish_display_data(data, source='bokeh'):
     try:
         displaypub.publish_display_data(source, data)
     except TypeError:
-        displaypub.publish_display_data(data)
\ No newline at end of file
+        displaypub.publish_display_data(data)


Test patch: