Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

WebAgg based jupyter notebook backend#29725

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

raphaelquast
Copy link
Contributor

@raphaelquastraphaelquast commentedMar 10, 2025
edited
Loading

I've been playing around a bit withwebagg andjupyter notebooks to finally get a backend that
fully supports the interactive features ofEOmaps... (e.g. that properly supports blitting)

In the process, I've noticed that it is possible to create a quite minimalist implementation of awebagg based backend forjupyter notebooks that does the job nicely!

The idea here is the following:

  • use aipywidgetsHTML widget to<iframe> the generatedwebagg page into the notebook.
  • adjust the size of the widget via a ´"resize_event"` callback on the figure

This works really nice out of the box and together with#27160 it is a backend that finally supports blitting in jupyter notebooks without any lags or glitches.

Would be nice to get an opinion from your side on this idea (and if you think something like this should go into matplotlib or if this is better kept insideEOmaps and loaded with%matplotlib module://eomaps.backend_webagg_widget.

PR checklist

@raphaelquastraphaelquast changed the titleAdd WebAggWidget backendWebAgg based jupyter notebook backendMar 10, 2025
@ianthomas23
Copy link
Member

This is an interesting technical approach and fine for local usage but it does not work for Jupyter notebooks in general.

At its heart Jupyter is a protocol for messages sent between a front end (web browser) and a backend (Jupyter server) that may be running on the same or different machine, and can spawn new kernel processes (e.g. python) on the same or different machines. The communication here to update the plot is using direct communication between the front end and webagg'stornado implementation, bypassing Jupyter messaging. It works fine in a local dev setup where you have the Jupyter server and kernel running on the same machine and you aren't too bothered about security. But there are many Jupyter installations (e.g.JupyterHub) in which one or both of those are no longer true.

So probably it is best not to claim that works in Jupyter. At best you will end up having to deal with questions abouttornado routing and security setup, and I would not wish that on anybody!

Note that to really get thewebagg backend working in Jupyter one would have to extend it to use Jupyter messaging. This is precisely what theipympl backend is, so that problem has already been solved.

I think your ultimate motivation here is to support blitting and avoid event accumulation in Matplotlib plots in Jupyter, in which case perhaps the best approach would be to continue with#27160. It looks like that was progressing well but stalled because you didn't have time to address the review comments. If you could get that working to your satisfaction here in thewebagg backend that would be great. You can ignoreipympl, someone else (possibly me) will ensure the changes are incorporated there eventually.

@raphaelquast
Copy link
ContributorAuthor

Thank you very much@ianthomas23 for your detailed comment! I fully agree with your view on this.

Indeedipympl is the proper way to implement a matplotlib backend for jupyter notebooks,
and finishing#27160 such that it works foripympl as well is the way to go here.

I can try to find the time to finish#27160 properly, but to be honest, one reason why I've lost a bit of pace is because I've been
waiting since 18 October 2023 to get some help implementing the requiredack message so that the solution can be used inipympl (#19116 (comment)) ... which was my goal here from the start.

I can fix the python-side, but I don't have the time to dig into the javascript code since it's not my expertise...
If someone (maybe you?) could create a branch inipympl that includes the necessary changes on the javascript side, I'd be happy to make sure that thewebagg event accumulation fix is implemented such that it does it's job equally well foripympl.

To be clear, anack message like this one should be all I need:

)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@raphaelquast@ianthomas23

[8]ページ先頭

©2009-2025 Movatter.jp