Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
IPython Widget #5754
Conversation
tacaswell
added the
needs_review
label
Dec 27, 2015
|
I'll back out the inadvertent changes to the UAT notebook in a subsequent commit. (done). |
|
Added toolbar. |
|
We can't install the nb extension from a wheel, so I'd recommend the following: check for the existence of the nb extension when importing |
|
The last commit implements the idea. |
|
The UAT passes now, except for |
|
Interact now works with nbagg (see demo above)! |
blink1073
referenced
this pull request
in ipython/ipython
Dec 27, 2015
Open
Cannot use interact with matplotlib figures that are updated in-place #7520
|
Note to self: add an explicit "export" button instead of spitting out an image automatically when the widget is closed. (done). |
blink1073
commented on the diff
Dec 27, 2015
jdfreder
commented
Dec 29, 2015
|
Cool! |
mdboom
commented on the diff
Dec 29, 2015
| @@ -98,6 +103,7 @@ def connection_info(): | ||
| 'zoom_to_rect': 'fa fa-square-o icon-check-empty', | ||
| 'move': 'fa fa-arrows icon-move', | ||
| 'download': 'fa fa-floppy-o icon-save', | ||
| + 'export': 'fa fa-file-picture-o icon-picture', |
mdboom
Owner
|
mdboom
commented on the diff
Dec 29, 2015
| + if (check_nbextension('matplotlib') or | ||
| + check_nbextension('matplotlib', True)): | ||
| + return | ||
| + | ||
| + # Make a temporary directory so we can wrap mpl.js in a requirejs define(). | ||
| + tempdir = mkdtemp() | ||
| + path = os.path.join(os.path.dirname(__file__), "web_backend") | ||
| + shutil.copy2(os.path.join(path, "nbagg_mpl.js"), tempdir) | ||
| + | ||
| + with open(os.path.join(path, 'mpl.js')) as fid: | ||
| + contents = fid.read() | ||
| + | ||
| + with open(os.path.join(tempdir, 'mpl.js'), 'w') as fid: | ||
| + fid.write('define(["jquery"], function($) {\n') | ||
| + fid.write(contents) | ||
| + fid.write('\nreturn mpl;\n});') |
mdboom
Owner
|
mdboom
commented on the diff
Dec 29, 2015
|
This is very cool. Thanks for taking this on.
I don't see how this relates. Maybe wrong issue number?
Can you elaborate on this? It seems to add a lot of complexity for reasons that are lost to me, as someone who hasn't really followed Jupyter/IPython widgets. How does this work in the context where the matplotlib package is installed system-wide? |
|
@mdboom, I removed the reference to 244, I can't find the issue I had meant to put there, it was referring to the fact that you could not "print" events to the notebook (as is now shown in the demo above). For reference, installing |
|
@mdboom, found it: jupyter/notebook#244 |
|
Sorry, I still don't understand the need for the complexity of installing the Python code and Javascript code separately. Can't we get to the JavaScript code from where it's installed under the matplotlib package (as we do now)? |
mdboom
referenced
this pull request
in jupyter/notebook
Dec 30, 2015
Closed
Improving 4.x nbextensions #878
pelson
commented on an outdated diff
Jan 3, 2016
|
Untested, but |
|
Just want to say that this is awesome, I'm glad progress is being made on #5111. |
jdfreder
commented
Jan 21, 2016
|
@mdboom I think you're interested in what I've proposed here: jupyter/notebook#116 |
|
@jdfreder: Thanks for the pointer. Indeed, it looks at first glance that jupyter/notebook#116 is moving in the direction that would really help us here. (It also helps me understand all the gory details and opposing requirements much better). |
mdboom
referenced
this pull request
Jan 29, 2016
Closed
Figures in the notebook backend are too large following DPI changes #5945
tacaswell
added this to the
2.1 (next point release)
milestone
Jan 29, 2016
izaid
commented
Apr 28, 2016
|
Hey all. And directly pinging @blink1073 @SylvainCorlay @mdboom. I'd really like to see this get merged into Matplotlib. I understand there are issues on the Jupyter side that may be holding this up. I can devote some of my time (on the order of days, if necessary) to get this resolved. Can someone tell me what needs to be done and what I can do to move things forward? |
|
Did jupyter settle how to do package and distribute the js side of the widgets? |
izaid
commented
Apr 28, 2016
|
@tacaswell I don't know the answer to that, and I'm not sure who to ask. Pinging @SylvainCorlay again (sorry), because I think he knows. I just want to volunteer my time and effort to finish this, and need some direction on what needs to be done. If the packaging isn't solved, can we not just merge this as is and have a follow-up PR for that? |
|
AFAIK this is what needs to be implemented (new in Notebook 4.2): http://jupyter-notebook.readthedocs.io/en/latest/examples/Notebook/Distributing%20Jupyter%20Extensions%20as%20Python%20Packages.html |
|
Pinging also @willingc & @JamiesHQ in case there's something in this discussion we can pick up regarding the documentation of how to deploy the extensions, so it can be on her radar. There's a chance the above link provided by @blink1073 is sufficient, but in case it leaves unanswered questions, we may want to fix that. The deployment of all the moving parts of extensions is a recurring question, so we want to make sure it's clearly documented. |
willingc
commented
Apr 28, 2016
•
|
@fperez Although I didn't read the full message tree, @blink1073's suggestion is the best doc we have at the moment. This should have how to handle Python and JS. Pinging @SylvainCorlay. If folks find stuff missing, please let me know. ipyleaflet by @ellisonbg would likely be helpful as well. |
|
Great, thx @willingc. Just wanted your keen eyes on this one :) |
|
That could be a good sprint subject for next week.
|
izaid
commented
Apr 28, 2016
|
Alright, this all sounds great. Thanks everyone for weighing in. I had a look at the "Distributing Jupyter Extensions" and don't have any questions so far. I'll take a stab at resolving this shortly, and will let you know if I do. |
|
@SylvainCorlay, would that approach would still allow this widget to be used without an internet connection? |
|
Yeah, the npmcdn is only for embedding in static web pages... And even in that case, it checks locally if you have the required package by the html file. |
|
Cool, thanks for the clarification. |
izaid
commented
Apr 30, 2016
•
|
Alright, I'm trying to get this done now. Basically, my understanding is that all we need to do is add a @blink1073 I had your PR working on my machine, but in the process of trying to achieve the above things broke. I very carefully removed, then reinstalled, Jupyter and your Matplotlib PR, but I'm now getting Does anyone know what that error means and how I can sort it out? I am in principle using a fresh installation of a Juypter and the original PR, that's all. Edit: To be clear, ipywidgets works, but the Matplotlib widget does not. |
|
I'm AFK right now but I believe you need to reinstall ipywidgets. |
izaid
commented
Apr 30, 2016
|
Okay, but ipywidgets is working fine? (And, I reinstalled it right now, just to be safe, and same issue. This is just a problem with the Matplotlib widget.) |
|
Irwin the path is now I recommend you create a requirejs config map mapping You can check the extension.js in bqplot or pythreejs for examples of how Okay, but ipywidgets is working fine? (And, I reinstalled it right now, just to be safe, and same issue. This is — |
izaid
commented
Apr 30, 2016
|
Thanks @SylvainCorlay, the issue was indeed a difference between Jupyter 4.1 and 4.2. @blink1073's PR works in 4.1, not 4.2, because of the path differences you pointed out. Should we be worrying about backwards compatibility here -- e.g., should Matplotlib be supporting both 4.1 and 4.2? Or is it sufficient to support only 4.2? |
|
This is a new feature that mpl has not shipped before we have no one who On Sat, Apr 30, 2016, 13:38 Irwin Zaid notifications@github.com wrote:
|
|
I would write the code for 4.2 onward. ipywidgets 5.x targets notebook 4.2 - and this is the version where we stabilized the Javascript APIs into the npm package |
izaid
referenced
this pull request
Apr 30, 2016
Closed
[WIP] Widgetizing the IPython notebook backend #6355
izaid
commented
Apr 30, 2016
|
New PR: #6355. Discussion can move there if this PR isn't going to be updated. |
|
@SylvainCorlay, I am actually at a loss at the moment. I'm going to have to leave this to you. |
|
I thought I had it working at one point, but I've spent all morning on this and have not gotten it figured out. |
izaid
commented
May 2, 2016
|
Yeah, I'm stumped here too. @SylvainCorlay, if you can drop in and save the day, that would be really cool. |
|
Okay, I've almost got it sorted. |
|
The latest change allows it to work, but the extension needs to installed on a per environment basis and enabled for the user in order to allow different versions per environment IIUC. |
izaid
commented
May 2, 2016
|
I just confirmed that it works on my local version of Jupyter 4.2. This is really great, thanks for picking this up again! Re: Local installation. Isn't that the model for Jupyter now? |
QuLogic
added the
GUI/nbagg
label
May 2, 2016
izaid
commented
May 4, 2016
|
@tacaswell @blink1073 So, I've been using this branch for a few days now, and my understanding is it is done. Any chance we can get this merged into master? I wouldn't mind building a few things on top of it, but I'd rather do that after merge in separate, unrelated PRs. |
|
I agree, this should be good to go. |
blink1073
changed the title from
[WIP] IPython Widget to IPython Widget
May 4, 2016
|
I am going to merge this on the good word of @blink1073 . |
tacaswell
merged commit 9c100c9
into matplotlib:master
May 4, 2016
tacaswell
removed the
needs_review
label
May 4, 2016
|
If people were doing things in the notebook which relied on the previous version of the js we shipped we will re-address adding it back. |
|
|
izaid
commented
May 4, 2016
|
This is actually a pretty big deal -- we can arrange plots in the IPython notebook now. Great work, @blink1073! |
|
|
|
and callbacks that raise exceptions no longer get silently ignored |
blink1073
referenced
this pull request
in jupyter/notebook
May 4, 2016
Closed
Print events from matplotlib event handlers get swallowed #244
|
Thanks everyone!! |
blink1073 commentedDec 27, 2015
Fixes #4582. Fixes #5111. Fixes #4940. Fixes #5219. Fixes jupyter/notebook#244.
Makes the nbagg canvas an IPython Widget.
mpl.jsis wrapped in adefine()and installed as annbextensionalongsidenbagg_mpl.js.