From e174fc572edd4a67c46a3fde0f6dfbf197519c8d Mon Sep 17 00:00:00 2001 From: Vidar Tonaas Fauske Date: Wed, 24 May 2017 18:22:34 +0200 Subject: [PATCH] Allow overriding embed_url for python embed code --- ipywidgets/widgets/embed.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ipywidgets/widgets/embed.py b/ipywidgets/widgets/embed.py index 95d11cdab43..6d63b55a834 100644 --- a/ipywidgets/widgets/embed.py +++ b/ipywidgets/widgets/embed.py @@ -183,6 +183,7 @@ def embed_snippet(widgets=None, expand_dependencies='full', drop_defaults=True, indent=2, + embed_url=None, ): """Return a snippet that can be embedded in an HTML file. """ @@ -193,9 +194,12 @@ def embed_snippet(widgets=None, for view_spec in data['view_specs'] ) - values = { + if embed_url is None: # TODO: Get widgets npm version automatically: - 'embed_url':'https://unpkg.com/jupyter-js-widgets@~3.0.0-alpha.0/dist/embed.js', + embed_url = 'https://unpkg.com/jupyter-js-widgets@~3.0.0-alpha.0/dist/embed.js' + + values = { + 'embed_url': embed_url, 'json_data': json.dumps(data['manager_state'], indent=indent), 'widget_views': widget_views, }