Serialising Panel Objects

Feature Request:

is it possible to serialise Panel objects? Let’s say I have something like this:

import panel as pn

import numpy as np
import matplotlib.pyplot as plt 

data = np.random.random(100)
plot = plt.plot(data, 'bo')
panel_obj = pn.Row("# My plot is cool: ", plot)

What would be cool is you could now save panel_obj to some sort of file, and then open it again to get exactly the same contents back. If I understand correctly, the data is also indirectly saved into the panel object. I know there is but how does one load again?

Use case:

I’m using holoviz to look at output from Earth System models. I can image automatically scripting some visualisations into the post-processing jobs. I could then use the resulting saved objects to piece together figures for slideshows, publications, etc…

This seems like a reasonable feature request. One of the main difficulties will be storing any callbacks that are created, a feature request on the issue tracker would be good.

Note that HoloViews already does support saving and exporting objects; see . HoloViews objects that aren’t Dynamic should be reliable to serialize and deserialize, and the archiving support was designed to make generating each figure fully reproducible. With DynamicMaps and Panel objects, it’s not necessarily going to be feasible to reconstitute everything, as those could depend on some external state that wasn’t captured with the object…


I would really like to see this feature implemented as well, my use case would be very similar to the one @pgierz described. Basically create plots, refine the layout, store to a file; load from the file alongside some other predefined panel objects and add it to a final report later. Seems very useful.

I was trying to use pickle and cloudpickle on a panel object which didn’t work even though my object had only static headers and matplotlib figs. I believe there are more callbacks internally that don’t make this happen. Also, tried to use hv.archive, like in: hv.archive.add(panel_obj), but it results in the following error: AttributeError: 'Column' object has no attribute 'group'. I think it needs to be a holoviews object.