Text of discourse.matplotlib.org › t › ipython-comm-backend › 18266 as Styx crawled it on Nov 19, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

IPython Comm backend - matplotlib-devel - Matplotlib

IPython Comm backend Development matplotlib-devel Jason_Grout2 October 10, 2013, 10:08pm 1 I've been working on a backend based on the webagg backend, but that uses the IPython Comm architecture at https://github.com/ipython/ipython/pull/4195 to send messages instead of starting a server and opening websocket connections. I have an initial version in my github ipython-comm branch (see https://github.com/jasongrout/matplotlib/compare/ipython-comm ).

I'm getting confused about how the backend infrastructure works, though, like what the purpose for the FigureManager class is, etc. I'm running out of time to work on this now, and I'm hoping that someone will take what work I've done here and get it working properly with the matplotlib architecture. If not, I'll probably tinker with this more later. Thanks, Jason ··· -- Jason Grout Michael_Droettboom October 16, 2013, 6:58pm 2 Sorry to take so long to get to this.

This is a nice piece of work. The most obvious thing is that this is a copy-and-paste of the existing WebAgg backend -- and maintaining the two is going to be much harder than building both out of the same pieces. As of 6389d14f, the WebAgg backend was refactored so that the transport that it uses to communicate to the browser is no longer hard coded. This was done in large part to support working with IPyhton in this way. (That is, it used to only communicate with the browser through Tornado, but now it can be anything that can send bits back and forth).

There's an example of this in `examples/user_interfaces/embedding_webagg.py` that shows how to do this (using Tornado, but again, it doesn't have to be). There's no guarantees that this interface is sufficient, so it may require some back and forth on this to make it all work. I think the first thing I would do would be to refactor this to use that. It's a little hard to tell what you've changed from the original WebAgg backend to get it to support IPython.

If it were built on top of, rather than in addition to, WebAgg, that would be more obvious. Mike ··· On 10/10/2013 06:08 PM, Jason Grout wrote: I've been working on a backend based on the webagg backend, but that uses the IPython Comm architecture at IPEP 21: widget messages by minrk · Pull Request #4195 · ipython/ipython · GitHub to send messages instead of starting a server and opening websocket connections. I have an initial version in my github ipython-comm branch (see Comparing matplotlib:main...jasongrout:ipython-comm · matplotlib/matplotlib · GitHub ).

I'm getting confused about how the backend infrastructure works, though, like what the purpose for the FigureManager class is, etc. I'm running out of time to work on this now, and I'm hoping that someone will take what work I've done here and get it working properly with the matplotlib architecture. If not, I'll probably tinker with this more later. Thanks, Jason -- Jason Grout ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance.

Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk _______________________________________________ Matplotlib-devel mailing list [email protected] matplotlib-devel List Signup and Options -- _ \/|o _|_ _. _ | | \.__ __|__|_|_ _ _ ._ _ >>(_| |(_|(/_| |_/|(_)(/_|_ |_|_)(_)(_)| | | Jason_Grout2 October 16, 2013, 8:46pm 3 Thanks for the feedback.

I was thinking that a refactor to pull out the communication layer would be really nice. I didn't change the WebAgg backend because I figured you wanted it around still. I figured a plain old diff with the file would reveal changes. Anyways, thanks for the pointer to the refactor commit. I hope to look at this again sometime soon. Jason ··· On 10/16/13 1:58 PM, Michael Droettboom wrote: Sorry to take so long to get to this.

This is a nice piece of work. The most obvious thing is that this is a copy-and-paste of the existing WebAgg backend -- and maintaining the two is going to be much harder than building both out of the same pieces. As of 6389d14f, the WebAgg backend was refactored so that the transport that it uses to communicate to the browser is no longer hard coded. This was done in large part to support working with IPyhton in this way. (That is, it used to only communicate with the browser through Tornado, but now it can be anything that can send bits back and forth).

There's an example of this in `examples/user_interfaces/embedding_webagg.py` that shows how to do this (using Tornado, but again, it doesn't have to be). There's no guarantees that this interface is sufficient, so it may require some back and forth on this to make it all work. I think the first thing I would do would be to refactor this to use that. It's a little hard to tell what you've changed from the original WebAgg backend to get it to support IPython.

If it were built on top of, rather than in addition to, WebAgg, that would be more obvious. Jason_Grout2 November 15, 2013, 1:24am 4 Following a very helpful conversation with Michael this morning in the dev hangout, I got this working with the current master (of matplotlib and ipython). The refactoring made the code much better; thanks! I updated the pull request at Initial, very rough, comm-based backend by mdboom · Pull Request #2524 · matplotlib/matplotlib · GitHub To test this, run IPython (master branch, to get the comm commits), and put this in a cell: Initial, very rough, comm-based backend by mdboom · Pull Request #2524 · matplotlib/matplotlib · GitHub Then you can execute something like: from matplotlib.figure import Figure import numpy as np fig = Figure() a = fig.add_subplot(111) t = np.arange(0.0, 3.0, 0.01) s = np.sin(2 * np.pi * t) a.plot(t, s) CommFigure(fig) and get a live figure in the IPython notebook that uses the comm messaging infrastructure.

Michael---do you have time to take it from here? Thanks, Jason ··· On 10/16/13 3:46 PM, Jason Grout wrote: On 10/16/13 1:58 PM, Michael Droettboom wrote: Sorry to take so long to get to this. This is a nice piece of work. The most obvious thing is that this is a copy-and-paste of the existing WebAgg backend -- and maintaining the two is going to be much harder than building both out of the same pieces. As of 6389d14f, the WebAgg backend was refactored so that the transport that it uses to communicate to the browser is no longer hard coded.

This was done in large part to support working with IPyhton in this way. (That is, it used to only communicate with the browser through Tornado, but now it can be anything that can send bits back and forth). There's an example of this in `examples/user_interfaces/embedding_webagg.py` that shows how to do this (using Tornado, but again, it doesn't have to be). There's no guarantees that this interface is sufficient, so it may require some back and forth on this to make it all work.

I think the first thing I would do would be to refactor this to use that. It's a little hard to tell what you've changed from the original WebAgg backend to get it to support IPython. If it were built on top of, rather than in addition to, WebAgg, that would be more obvious. Thanks for the feedback. I was thinking that a refactor to pull out the communication layer would be really nice. I didn't change the WebAgg backend because I figured you wanted it around still.

I figured a plain old diff with the file would reveal changes. Anyways, thanks for the pointer to the refactor commit. I hope to look at this again sometime soon. Jason_Grout2 November 15, 2013, 1:18pm 5 I also got this initial experimental demo working on the Sage cell server: Sage Cell Server (for a sage plotting example) Sage Cell Server (for one of the examples from the matplotlib docs) Thanks, Jason ··· On 11/14/13 7:24 PM, Ja

The rest of this page is on the live site.