From 5483be8c9199133b2ed6aad35bc38e538c5d72d1 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Tue, 26 Mar 2019 18:17:01 +0000 Subject: [PATCH] Switch to HTML mime bundle (#3574) --- holoviews/ipython/display_hooks.py | 14 +++++++------- setup.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/holoviews/ipython/display_hooks.py b/holoviews/ipython/display_hooks.py index 3c3c817d52..d78a6b3078 100644 --- a/holoviews/ipython/display_hooks.py +++ b/holoviews/ipython/display_hooks.py @@ -4,7 +4,7 @@ from functools import wraps from contextlib import contextmanager -import os, sys, traceback +import sys, traceback import IPython from IPython import get_ipython @@ -142,20 +142,20 @@ def wrapped(element): mimebundle = fn(element, max_frames=max_frames) if mimebundle is None: return {}, {} - - html = mimebundle_to_html(mimebundle) - if os.environ.get('HV_DOC_HTML', False): - mimebundle = {'text/html': html}, {} + mime_data, mime_metadata = mimebundle + if 'text/javascript' in mime_data: + mime_data['text/html'] = mimebundle_to_html(mime_data) + del mime_data['text/javascript'] # Only want to add to the archive for one display hook... disabled_suffixes = ['png_display', 'svg_display'] if not any(fn.__name__.endswith(suffix) for suffix in disabled_suffixes): if type(holoviews.archive) is not FileArchive: - holoviews.archive.add(element, html=html) + holoviews.archive.add(element, html=mime_data['text/html']) filename = OutputSettings.options['filename'] if filename: Store.renderers[Store.current_backend].save(element, filename) - return mimebundle + return mime_data, mime_metadata except SkipRendering as e: if e.warn: sys.stderr.write(str(e)) diff --git a/setup.py b/setup.py index d862dacf2e..badcfee7df 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup_args = {} -install_requires = ['param>=1.8.0,<2.0', 'numpy>=1.0', 'pyviz_comms>=0.7.0'] +install_requires = ['param>=1.8.0,<2.0', 'numpy>=1.0', 'pyviz_comms>=0.7.2'] extras_require = {}