convert mandelbrot/julia interact to jupyter notebook
fchapoton opened this issue · 56 comments
as another step to python3
Depends on #25373
CC: @bbarros50 @bhutz @sagetrac-atowsley @kcrisman @embray @jdemeyer @jm58660
Component: notebook
Author: Frédéric Chapoton, Jeroen Demeyer
Branch/Commit: 4de168d
Reviewer: Frédéric Chapoton, Jeroen Demeyer
Issue created by migration from https://trac.sagemath.org/ticket/24994
work in progress, not yet working as expected..
New commits:
a9e184d | first tentative of conversion of mandelbrot interact to jupyter interact |
Branch: public/24994
Branch pushed to git repo; I updated commit sha1. New commits:
52ce4a5 | second pass at interactive mandelbrot/julia in ipython notebook |
Branch pushed to git repo; I updated commit sha1. New commits:
c65a01c | fixing colors and other details |
Branch pushed to git repo; I updated commit sha1. New commits:
7cbf77b | trying to fix doctests.. |
ok, working now. Except 3 failing doctests that I just fail to write using ellipsis !
Author: Frédéric Chapoton
Branch pushed to git repo; I updated commit sha1. New commits:
4467110 | pep8 and pyflakes cleanup |
Branch pushed to git repo; I updated commit sha1. New commits:
588ac04 | fixing doctests (ugly) |
This is bad:
M = mandelbrot_interact
...adjust various attributes of M...
return M
The problem is that you are changing and returning a unique global object. Instead of having
@interact.widget
def mandelbrot_interact(...
it would be better to just define mandelbrot_interact as an ordinary function and call interact.widget() inside the mandelbrot_plot function. That way, you end up with non-unique widgets.
Can you explain the <CSI-2K> appearing in the doctests? I feel uncomfortable accepting that without knowing where it comes from.
Branch pushed to git repo; I updated commit sha1. New commits:
8bdbb0d | made the suggested changes |
Better like that ?
ping ?
ping ?
review, please ?
ping again
Could please someone have a look at the result here ? This seems to work well, and is a good step in getting rid of the dependencies to sagenb.
It looks good to me. I had just moved the imports from sagenb inline, but this is obviously a more complete approach. I haven't tested it, but if you say it works it's good enough for me.
It seems not to be working anymore.. :(
Jeroen, any idea of what should be done, please ?
Here is the message I get (once disactivating the image):
Failed to display Jupyter Widget of type sage_interactive.
If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean that the widgets JavaScript is still loading. If this message persists, it likely means that the widgets JavaScript library is either not installed or not enabled. See the Jupyter Widgets Documentation for setup instructions.
If you're reading this message in another frontend (for example, a static rendering on GitHub or NBViewer), it may mean that your frontend doesn't currently support widgets.
This is not specific to the widget built here. Simple basic widgets have the same issue. Could someone confirm this issue ?
import ipywidgets as widgets
widgets.Checkbox()
I can see no problem with mandelbrot_plot(interact=True) on sage --notebook=ipython; another thing is sage --notebook=sagenb which just says "Interactive function <function mandelbrot_interact . . ."
But the main idea of fractal does not work when there is no widget for infinite zooming.
If it works for you (in which version of sage ?), then one can probably set this to positive review. My install should be somehow broken.
Yes, this is a pity that there is no good clickable-picture widget. But the main aim here is to move towards python3 by geeting rid of all imports of sagenb.
Replying to @fchapoton:
If it works for you (in which version of sage ?), then one can probably set this to positive review. My install should be somehow broken.
I had 8.2rc4, and with git trac checkout... of this ticket I got 8.2beta8. So should I try to merge this to newest beta/rc version?
Yes, this is a pity that there is no good clickable-picture widget. But the main aim here is to move towards python3 by geeting rid of all imports of sagenb.
OK.
Replying to @jm58660:
So should I try to merge this to newest beta/rc version?
I did this. No changes, it wotks.
Thanks a lot. Feel free to set to positive, then.
Hmm... I don't know about those widgets. The code seems clear. Jeroen, have you checked this?
Changed author from Frédéric Chapoton to Frédéric Chapoton, Jeroen Demeyer
I'm not so happy that the input to mandelbrot_plot() is now completely ignored when interact=True is given. I'll try to work on this.
I will rebase on #25074. That's not strictly needed, but it's good to test against the newest version of ipywidgets.
Is this still "needing work", Jeroen ?
This is the place where docbuild currently fails on the python3 patchbot. See
This is working fine, the only issue is comment:29
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
8143016 | first tentative of conversion of mandelbrot interact to jupyter interact |
OK, I'll work on this today.
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
56b571f | Improve Mandelbrot/Julia interact |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
4de168d | Improve Mandelbrot/Julia interact |
Reviewer: Frédéric Chapoton, Jeroen Demeyer
I think I can reasonably set this to positive now.
Changed branch from public/24994 to 4de168d