config Module#

config Module#

The config module supplies the global config object and the extension which provides convenient support for loading and configuring panel components.

class panel.config.panel_extension(*args, **kwargs)[source]#

Bases: extension

Initializes and configures Panel. You should always run pn.extension. This will

  • Initialize the pyviz notebook extension to enable bi-directional

communication and for example plotting with Bokeh. - Load .js libraries (positional arguments). - Update the global configuration pn.config (keyword arguments).

Reference: https://github.com/holoviz/panel/issues/3404

Example

>>> import panel as pn
>>> pn.extension("plotly", sizing_mode="stretch_width", template="fast")

This will

  • Initialize the pyviz notebook extension.

  • Enable you to use the Plotly pane by loading plotly.js.

  • Set the default sizing_mode to stretch_width instead of fixed.

  • Set the global configuration pn.config.template to fast, i.e. you

will be using the FastListTemplate.

instance(**params)#

Return an instance of this class, copying parameters from any existing instance provided.

script_repr(imports=[], prefix='    ')#

Same as Parameterized.script_repr, except that X.classname(Y is replaced with X.classname.instance(Y