depends Module#

depends Module#

panel.depends.bind(function, *args, watch=False, **kwargs)[source]#

Given a function, returns a wrapper function that binds the values of some or all arguments to Parameter values and expresses Param dependencies on those values, so that the function can be invoked whenever the underlying values change and the output will reflect those updated values.

As for functools.partial, arguments can also be bound to constants, which allows all of the arguments to be bound, leaving a simple callable object.

Arguments#

function: callable

The function to bind constant or dynamic args and kwargs to.

args: object, param.Parameter

Positional arguments to bind to the function.

watch: boolean

Whether to evaluate the function automatically whenever one of the bound parameters changes.

kwargs: object, param.Parameter

Keyword arguments to bind to the function.

Returns#

Returns a new function with the args and kwargs bound to it and annotated with all dependencies.

panel.depends.depends(func, *dependencies, watch=False, on_init=False, **kw)[source]#

Annotates a function or Parameterized method to express its dependencies.

The specified dependencies can be either be Parameter instances or if a method is supplied they can be defined as strings referring to Parameters of the class, or Parameters of subobjects (Parameterized objects that are values of this object’s parameters). Dependencies can either be on Parameter values, or on other metadata about the Parameter.

Parameters#

watchbool, optional

Whether to invoke the function/method when the dependency is updated, by default False

on_initbool, optional

Whether to invoke the function/method when the instance is created, by default False