Open benbovy opened 1 year ago
This sounds exciting! Assuming the minimal dependencies are not too painful to add, this sounds like a nice way to add optional dynamic effects.
Do you understand how they solve JavaScript sandboxing issue? Or maybe that only works on particular notebook implementations?
Great idea. One thing this could be useful for is interactively visualizing the structure of DataTree
objects. https://github.com/xarray-contrib/datatree/issues/207
Perhaps this would better be implemented in a third party package that xarray would optionally depend on, and fallback to the pure html/css repr if it is not installed.
Anywidget relies on standard ES modules, which I think makes it more easily front-end agnostic.
@TomNicholas yes we have just talked about that with @keewis !
I started experimenting with this in https://github.com/benbovy/xarray-fancy-repr
started experimenting with this in https://github.com/benbovy/xarray-fancy-repr
First release is now available on PyPI: pip install xarray-fancy-repr
!
It has reprs for Dataset, DataArray, Coordinates and Variable (copied from the Xarray html reprs). For now it also implements a basic search tool to filter variables and attributes (by name, dimension and/or attributes). I opened a few issues for other ideas.
Now that's pretty cool!
One really cool direction to take this would be to add automatic visualization of the data variables. Like, rather than just showing the dask repr or a bunch of numbers, could we make an interactive plot appear?
One really cool direction to take this would be to add automatic visualization of the data variables. Like, rather than just showing the dask repr or a bunch of numbers, could we make an interactive plot appear?
Yes there is room for adding another few icons next to each variable inline repr for that.
Very cool!
What is your issue?
In Xarray we already have the plain-text and html reprs, which is great.
Recently, I've tried anywidget and I think that it has potential to overcome some of the limitations of the current repr and possibly go well beyond it.
The main advantages of anywidget:
I don't think we should replace the current html repr (it is still useful to have a basic, pure HTML/CSS version), but having a new widget could improve some aspects like not including the whole CSS each time an object repr is displayed, removing some HTML/CSS hacks... and actually has much more potential since we would have the whole javascript ecosystem at our fingertips (quick plots, etc.). Also bi-directional communication with Python is possible.
I'm opening this issue to brainstorm about what would be nice to have in widget-based Xarray reprs:
cc @pydata/xarray