BUGFIX: offline=True kwarg in embed_html was failing to save dependency jupyter-threejs.js#198
BUGFIX: offline=True kwarg in embed_html was failing to save dependency jupyter-threejs.js#198GenevieveBuckley wants to merge 8 commits intowidgetti:masterfrom
Conversation
…lume in a html file.
…saving functions - currently all require you to be online when you save to html.
maartenbreddels
left a comment
There was a problem hiding this comment.
Thanks, indeed, this was missing. I need to talk to @vidartf about how to get the right threejs version, so I'll get back to you. Many thanks already!
ipyvolume/_version.py
Outdated
| __version_tuple_js__ = (0, 5, 2, 'dev.1') | ||
| __version_js__ = '0.5.2-dev.1' | ||
| __version_threejs__ = '0.91' # kept for embedding in offline mode, we don't care about the patch version since it should be compatible No newline at end of file | ||
| __version_threejs__ = '2.0.1' |
There was a problem hiding this comment.
threejs is at version 98 btw: https://threejs.org/
pythreejs is what you meant, I know, it is confusing.
I'll talk with @vidartf about it, how we can get the right threejs version that matches the pythreejs one.
There was a problem hiding this comment.
Ah yes, I've updated the variable name to be clearer: __version_pythreejs__. The actual __version_threejs__ never got used (the master branch has some stuff commented out) so I haven't included that in _version.py
Yes, it would be good to know what you and @vidartf decide is the best way to keep threejs/pythreejs in sync.
|
As it is now, threejs is embeded in jupyter-threejs's embed.js, although it shouldn't, and it is actually configured using require's path in https://github.com/jupyter-widgets/pythreejs/blob/master/js/src/embed.js @GenevieveBuckley it might be that the PR as it is now is working, can you confirm that? ipyvolume and jupyter-threejs have their own version of threejs, which is non-ideal, but if it works, it works. |
|
Yes, I can confirm that it works for these circumstances: python version 3.6.6 I tested using this code while connected to the internet (writing to file won't work if you're not connected): import numpy as np
import ipyvolume as ipv
y = np.random.randn(1000)
x = np.random.randn(1000)
z = np.random.randn(1000)
fig = ipv.figure()
ipv.scatter(x, y, z)
ipv.embed.embed_html('offline_test.html', fig, offline=True, devmode=True)Once offline, reading the file is successful across all browsers I have available:
|
e861e87 to
6dead3f
Compare
This PR adds a function
save_jupyterthreejstoembed.pyto download and save thejupyter-threejs.jsdependency required for offline viewing of ipyvolume html files.Closes #192