Difference between param.Parameterized and pn.viewable.Viewer?

Hi,

Are there any practical differences between the two classes? Viewer inherits from Parameterized, which can already be viewed easily thanks to the panel method.

I believe Viewer just makes it behave like a Panel object, i.e. include show(), servable(), etc. Combine Existing Components β€” Panel v1.4.2

You can check out the source code here:

2 Likes

Thanks @ahuang11

I think if you put a param.Parameterized object within a layout, I think it’s converted into a Viewer, just as a Holoviews plot is converted into a Holoviews pane. So Viewer is only useful if you need the panel object interface.

There is a big difference.

  • With a param.Parameterized object you will be viewing its parameters via pn.Param.
  • With a pn.viewable.Viewer object you will be viewing what ever its __panel__ method returns.

So the first will work like a settings object you would like to put in your sidebar.
The latter can be used to display a plot, table, some widgets (settings) or a combination.

The purpose of the tutorial Reusable Components is to teach the use of Parameterized and Viewable and when to use which.

The Structure with a DataStore builds on the Reusable Components tutorial and really shows how to use the Viewable class.

2 Likes