Parameters#

Base#

Parameter

Base Parameter type to hold any type of Python object.

Parameter methods and properties#

Parameter.label

Get the label for this parameter.

Parameter.rx

The reactive operations namespace.

Parameter.schema([safe, subset, mode])

Generate a schema for the parameters of the Parameterized object.

Parameter.deserialize(value)

Given a serializable Python value, return a value that the parameter can be set to.

Parameter.serialize(value)

Given the parameter value, return a Python value suitable for serialization.

Parameter subclasses#

String

A String Parameter with optional regular expression (regex) validation.

Bytes

A Bytes Parameter, with a default value and optional regular expression (regex) matching.

Color

Color parameter defined as a hex RGB string with an optional # prefix or (optionally) as a CSS3 color name.

Boolean

Binary or tristate Boolean Parameter.

Event

An Event Parameter is one whose value is intimately linked to the triggering of events for watchers to consume.

Dynamic

Parameter whose value can be generated dynamically by a callable object.

Number

A numeric Dynamic Parameter, with a default value and optional bounds.

Integer

Numeric Parameter required to be an Integer.

Magnitude

Numeric Parameter required to be in the range [0.0-1.0].

Tuple

A tuple Parameter (e.g. ('a', 7.6, [3,5])) with a fixed tuple length.

NumericTuple

A numeric tuple Parameter (e.g. (4.5, 7.6, 3)) with a fixed tuple length.

XYCoordinates

A NumericTuple for an X,Y coordinate.

Range

A numeric range with optional bounds and softbounds.

Date

Date parameter of datetime or date type.

DateRange

A datetime or date range specified as (start, end).

CalendarDate

Parameter specifically allowing dates (not datetimes).

CalendarDateRange

A date range specified as (start_date, end_date).

List

Parameter whose value is a list of objects, usually of a specified type.

HookList

Parameter whose value is a list of callable objects.

Path

Parameter that can be set to a string specifying the path of a file or folder.

Filename

Parameter that can be set to a string specifying the path of a file.

Foldername

Parameter that can be set to a string specifying the path of a folder.

Selector

Parameter whose value must be one object from a list of possible objects.

FileSelector

Given a path glob, allows one file to be selected from those matching.

ListSelector

Variant of Selector where the value can be multiple objects from a list of possible objects.

MultiFileSelector

Given a path glob, allows multiple files to be selected from the list of matches.

ClassSelector

Parameter allowing selection of either a subclass or an instance of a class or tuple of classes.

Dict

Parameter whose value is a dictionary.

Array

Parameter whose value is a numpy array.

Series

Parameter whose value is a pandas Series.

DataFrame

Parameter whose value is a pandas DataFrame.

Callable

Parameter holding a value that is a callable object, such as a function.

Action

A user-provided function that can be invoked like a class or object method using ().

Composite

A Parameter that is a composite of a set of other attributes of the class.

Helpers#

get_soft_bounds(bounds, softbounds)

For each soft bound (upper and lower), if there is a defined bound (not equal to None) and does not exceed the hard bound, then it is returned.

guess_bounds(params, **overrides)

Given a dictionary of Parameter instances, return a corresponding set of copies with the bounds appropriately set.

guess_param_types(**kwargs)

Given a set of keyword literals, promote to the appropriate parameter type based on some simple heuristics.

param_union(*parameterizeds[, warn])

Given a set of Parameterized objects, returns a dictionary with the union of all param name,value pairs across them.

parameters.Time(*, label, time_type, ...)

A callable object returning a number for the current time.

resolve_path(*, path_to_file, search_paths, name)

Find the path to an existing file, searching the paths specified in the search_paths parameter if the filename is not absolute, and converting a UNIX-style path to the current OS's format if necessary.