Serialising Panel Objects

Feature Request:

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

import panel as pn
pn.extension()

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 panel_obj.save 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 http://holoviews.org/user_guide/Exporting_and_Archiving.html . 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…