perspective icon indicating copy to clipboard operation
perspective copied to clipboard

Enable using Perspective in Panel similarly to using Perspective in Jupyter

Open MarcSkovMadsen opened this issue 4 years ago • 7 comments

My Pain

I (try to) develop awesome analytics apps in Python for traders at work and for fun and to share knowledge in my spare time. One of the python frameworks I enjoy using is Panel. See also awesome-panel.org that I'm developing.

I would really like to use Perspective in Panel and I also would like to that others have the opportunity as well.

But currently this is not supported.

Solution

Add a Perspective widget to Panel or alternatively add support for Panel to Perspective.

Additional info

  • Panel normally runs on top of the Bokeh Server but can also run on top of other Servers like Flask, Django and Voila.

  • To enable support in Panel you would start building a Bokeh model of Perspective

    • Normally the Bokeh model on the server and in the client is kept in sync by Bokeh serialization and communication. Here we would have to consider whether the Perspective communication based on Arrow could be used instead to speed up thing.
  • An alternative to a custom implementation for Panel is just to use the Perspective Jupyter version. Because soon all IPyWidgets can be used directly in Panel. But this is not as performant and powerfull (I believe) as a "native" Panel implementation.

  • There is already a feature request for Perspective in the Panel repo https://github.com/holoviz/panel/issues/1107

I added a feature request in the Perspective project because maybe there is some interest in this community and some of you might want to contribute interest, ideas, knowledge, support or actual code. Furthermore I just wanted to share the progress from Panel if any. I have a hope to be able to contribute something my self.

MarcSkovMadsen avatar Feb 22 '20 06:02 MarcSkovMadsen

To put the expected effort into perspective :-) I co-contributed a widget for DeckGl to Panel.

I had never tried it before. I needed to learn something about Bokeh Models and how they are implemented using TypeScript. Then I implemented the first version of the DeckGL widget. It took me ~10hours. The Philipp (BDFL of Panel) helped get all the details right and he worked very hard for a day or two.

I also co-contributed two reference example notebooks to illustrate how the widget was used. Spend maybe 5 hours on this.

https://panel.holoviz.org/gallery/param/deck_gl_global_power_plants.html#param-gallery-deck-gl-global-power-plants

image

MarcSkovMadsen avatar Feb 22 '20 06:02 MarcSkovMadsen

@MarcSkovMadsen this has always been on our radar as @ceball and I work on the same team at JP Morgan. We will discuss priorities and respond here next week

timkpaine avatar Feb 22 '20 15:02 timkpaine

FYI.

I've started adding support for the perspective-viewer web component to Panel. Only.

For more information see https://github.com/holoviz/panel/pull/1122#issuecomment-596169367

MarcSkovMadsen avatar Mar 08 '20 05:03 MarcSkovMadsen

Just for the record. The basic functionality for the perspective-viewer web component (not python package) has been implemented and is working well. The things that I would expect not working are streaming and getting selected rows back. But the rest I would expect to work just fine.

It would support my use case for now based on this simple implementation.

But I hope someone would take it to a higher level implementing this as a true Panel pane that supports all the functionality of the Perspective python package and fast data transfer including streaming.

perspective

FYI. @timkpaine

MarcSkovMadsen avatar Mar 21 '20 08:03 MarcSkovMadsen

FYI. I've added an example to the gallery at awesome-panel.org

test_perspective

MarcSkovMadsen avatar May 24 '20 17:05 MarcSkovMadsen

I've added the perspective-viewer to the awesome-panel-extensions Package so that it is available for all Panel users.

Use it via from awesome_panel_extensions.widgets.perspective_viewer import PerspectiveViewer.

I hope it will be moved to Panel in the next release.

FYI. @timkpaine. Feel free to check it out. Any suggestions and comments are much appreciated. Its based on a Bokeh extension (typescript + python).

https://github.com/MarcSkovMadsen/awesome-panel-extensions/blob/master/awesome_panel_extensions/bokeh_extensions/perspective_viewer.ts https://github.com/MarcSkovMadsen/awesome-panel-extensions/blob/master/awesome_panel_extensions/bokeh_extensions/perspective_viewer.py

It could actually be made generally available in general to Bokeh users with a few steps like adding documenation and examples.

I've announced it on the Bokeh discourse here https://discourse.bokeh.org/t/perspectiveviewer-extension/6204. Maybe someone shows interest one day.

The Panel extension is here.

https://github.com/MarcSkovMadsen/awesome-panel-extensions/blob/master/awesome_panel_extensions/widgets/perspective_viewer.py

There is a jupyter reference notebook as well.

MarcSkovMadsen avatar Aug 23 '20 04:08 MarcSkovMadsen

I see indications that some of the plugins support row selection and editing. But I've not been able to find any documention on this. Please provide links or information if possible. Then I could support this in the Panel widget.

Thanks.

MarcSkovMadsen avatar Aug 23 '20 04:08 MarcSkovMadsen

Perspective has been available in Panel for a long time now. And its awesome. See https://panel.holoviz.org/reference/panes/Perspective.html

I will close this one.

MarcSkovMadsen avatar Jun 08 '23 17:06 MarcSkovMadsen