-
Notifications
You must be signed in to change notification settings - Fork 557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade ipywidgets to v7, with a fallback for v6 #738
Conversation
[WIP] Upgrade ipywidgets to v7. Add fallback for v6 widgets.
Use v6 widgets when version_major is not defined
I'd love to see this make it in but do wonder about our ongoing ability to maintain it and/or extend to other mime renderers. If there's any way that we can make future modifications one-liners to a single (json) file, that would be preferable. At a minimum, I'd like to see the |
The code looks okay to me. @bollwyvl - do you have any tips on how to make that URL configurable? |
@jasongrout @bollwyvl any updates here? |
I think I figured out how to make it configurable. Basically, look in https://github.com/jupyter/nbviewer/blob/master/nbviewer/providers/base.py and https://github.com/jupyter/nbviewer/blob/master/nbviewer/app.py for "mathjax_url" and do something similar for the ipywidgets url (you'll probably have two ipywidgets urls, one for v6, one for v7). |
If we want to do this configuration in a separate PR, I'm okay with that as well. This PR is good and self-contained as an upgrade as-is, though I agree with @bollwyvl that having a configurable URL would be nice. |
In fact, if you've tested this PR as-is, I'd be inclined to merge this as-is and then we can do the configuration changes in a separate PR. Let me know if you want to do the configuration in this one, though. |
Actually, looking more into the source code for nbviewer, I do have one more comment on this PR. As-is, the widgets code is added in the layout.html template, but I think that's the wrong place (and it was wrong before - not your fault!). The layout template is used for things like the page listing all of the notebooks, etc. Instead the widgets code should be added to the https://github.com/jupyter/nbviewer/blob/master/nbviewer/templates/notebook.html template, right next to the mathjax block at nbviewer/nbviewer/templates/notebook.html Line 51 in ffda79b
And please let us know if you want to do the configuration changes in this PR, or if we should open an issue/PR for it separately. |
Hi, sorry for the delay. It's absolutely good to go, as we want widgets :) I guess there are two dimensions of configuration:
So the easiest answer from the downstream perspective would be that the mimetype itself would carry enough information to determine what we need to render it. Having to pre-parse the content that will get re-parsed again seems pretty rough... what if the json is bad? Then we'd need a simple file someplace, probably realizable in the config file, or at least pointed to by the config file. This could then either be requested with Anyhow... I boiled all this down to some ideas here: https://nbviewer.jupyter.org/gist/anonymous/a44bf8d688135d58588c07dd61ec90ee |
Have not 😊
Right, this pattern, but have a plan for something more general and replaceable. If the path of justice is
Yes, this. Also, probably go ahead and wrap it in a |
Note that jsdelivr also supports the 'anything that is an npm package is available' - we've looked at switching to it. |
thanks for the comments. |
Great, thanks!
Sounds good! I made an issue: #739. |
#717 move ipywidgets scripts to notebook.html
Had a chance to try this out locally: looking good! The updates are looking robust, but more byzantine: I'd like us to start thinking about this in a more systematic way that will permit handling the anticipated explosion of mime renderers. Anyhow, out of scope for this issue, I suppose. One regression I'm seeing is that (on chrome, but not FF), the imported material design stuff is changing some site chrome, initially have noticed link colors: vs 6.x This is from an eager un-namespaced We can either get more aggressive on this in the nbviewer selectors, but it might be a good thing to push upstream... not sure if it's worth holding up the |
Thanks for the detailed testing. This is a big blocker for us and i think the CSS fix lies elsewhere... |
ping... |
Thanks for the ping - it's in my queue to look at today. |
@bollwyvl - do you know where that |
I reproduced the css styling problem, and tracked it down to the widgets embed script. I'll be solving that upstream. I think this code looks good. I probably would have used |
I also confirmed this works great for ipywidgets 6. Thanks again! |
🐬 🐬 |
The blue link issue is traced back to JupyterLab: jupyterlab/jupyterlab#3257 |
when will this be deployed to the live service http://nbviewer.jupyter.org/ ? |
Great question. I don't know how deployment works for nbviewer. |
Let's ask on the jupyterhub gitter channel. |
looks like it happened. |
Great! And we're working on fixing that CSS issue upstream, which should show up when we push an updated jupyterlab and ipywidgets. |
This should be deployed to nbviewer. Sorry for taking so long. @jasongrout I've added you on the private nbviewer-deploy repo, so you should be able to do a deploy if you want. |
Thanks! |
fix #717