# param.param Package¶

## param Package¶

digraph inheritance6ce4706456 { bgcolor=transparent; fontsize=18; rankdir=LR; size="12.0, 12.0"; "param.__init__.Action" [URL="#param.__init__.Action",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A user-provided function that can be invoked like a class or object method using ()."]; "param.__init__.Callable" -> "param.__init__.Action" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.Array" [URL="#param.__init__.Array",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Parameter whose value is a numpy array."]; "param.__init__.ClassSelector" -> "param.__init__.Array" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.Boolean" [URL="#param.__init__.Boolean",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Binary or tristate Boolean Parameter."]; "param.parameterized.Parameter" -> "param.__init__.Boolean" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.CalendarDate" [URL="#param.__init__.CalendarDate",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="CalendarDate parameter of date type."]; "param.__init__.Number" -> "param.__init__.CalendarDate" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.CalendarDateRange" [URL="#param.__init__.CalendarDateRange",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A date range specified as (start_date, end_date)."]; "param.__init__.Range" -> "param.__init__.CalendarDateRange" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.Callable" [URL="#param.__init__.Callable",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Parameter holding a value that is a callable object, such as a function."]; "param.parameterized.Parameter" -> "param.__init__.Callable" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.ClassSelector" [URL="#param.__init__.ClassSelector",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Parameter allowing selection of either a subclass or an instance of a given set of classes."]; "param.__init__.SelectorBase" -> "param.__init__.ClassSelector" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.Color" [URL="#param.__init__.Color",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Color parameter defined as a hex RGB string with an optional #"]; "param.parameterized.Parameter" -> "param.__init__.Color" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.Composite" [URL="#param.__init__.Composite",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A Parameter that is a composite of a set of other attributes of the class."]; "param.parameterized.Parameter" -> "param.__init__.Composite" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.DataFrame" [URL="#param.__init__.DataFrame",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Parameter whose value is a pandas DataFrame."]; "param.__init__.ClassSelector" -> "param.__init__.DataFrame" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.Date" [URL="#param.__init__.Date",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Date parameter of datetime or date type."]; "param.__init__.Number" -> "param.__init__.Date" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.DateRange" [URL="#param.__init__.DateRange",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A datetime or date range specified as (start, end)."]; "param.__init__.Range" -> "param.__init__.DateRange" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.Dict" [URL="#param.__init__.Dict",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Parameter whose value is a dictionary."]; "param.__init__.ClassSelector" -> "param.__init__.Dict" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.Dynamic" [URL="#param.__init__.Dynamic",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Parameter whose value can be generated dynamically by a callable"]; "param.parameterized.Parameter" -> "param.__init__.Dynamic" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.Event" [URL="#param.__init__.Event",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An Event Parameter is one whose value is intimately linked to the"]; "param.__init__.Boolean" -> "param.__init__.Event" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.FileSelector" [URL="#param.__init__.FileSelector",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Given a path glob, allows one file to be selected from those matching."]; "param.__init__.ObjectSelector" -> "param.__init__.FileSelector" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.Filename" [URL="#param.__init__.Filename",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Parameter that can be set to a string specifying the path of a file."]; "param.__init__.Path" -> "param.__init__.Filename" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.Foldername" [URL="#param.__init__.Foldername",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Parameter that can be set to a string specifying the path of a folder."]; "param.__init__.Path" -> "param.__init__.Foldername" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.HookList" [URL="#param.__init__.HookList",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Parameter whose value is a list of callable objects."]; "param.__init__.List" -> "param.__init__.HookList" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.Infinity" [URL="#param.__init__.Infinity",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An instance of this class represents an infinite value. Unlike"]; "param.__init__.Integer" [URL="#param.__init__.Integer",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Numeric Parameter required to be an Integer"]; "param.__init__.Number" -> "param.__init__.Integer" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.List" [URL="#param.__init__.List",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Parameter whose value is a list of objects, usually of a specified type."]; "param.parameterized.Parameter" -> "param.__init__.List" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.ListSelector" [URL="#param.__init__.ListSelector",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Variant of ObjectSelector where the value can be multiple objects from"]; "param.__init__.ObjectSelector" -> "param.__init__.ListSelector" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.Magnitude" [URL="#param.__init__.Magnitude",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Numeric Parameter required to be in the range [0.0-1.0]."]; "param.__init__.Number" -> "param.__init__.Magnitude" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.MultiFileSelector" [URL="#param.__init__.MultiFileSelector",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Given a path glob, allows multiple files to be selected from the list of matches."]; "param.__init__.ListSelector" -> "param.__init__.MultiFileSelector" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.Number" [URL="#param.__init__.Number",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A numeric Dynamic Parameter, with a default value and optional bounds."]; "param.__init__.Dynamic" -> "param.__init__.Number" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.NumericTuple" [URL="#param.__init__.NumericTuple",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A numeric tuple Parameter (e.g. (4.5,7.6,3)) with a fixed tuple length."]; "param.__init__.Tuple" -> "param.__init__.NumericTuple" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.ObjectSelector" [URL="#param.__init__.ObjectSelector",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Parameter whose value must be one object from a list of possible objects."]; "param.__init__.SelectorBase" -> "param.__init__.ObjectSelector" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.Path" [URL="#param.__init__.Path",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Parameter that can be set to a string specifying the path of a file or folder."]; "param.parameterized.Parameter" -> "param.__init__.Path" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.Range" [URL="#param.__init__.Range",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A numeric range with optional bounds and softbounds"]; "param.__init__.NumericTuple" -> "param.__init__.Range" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.Selector" [URL="#param.__init__.Selector",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A more user friendly ObjectSelector that picks the first object for"]; "param.__init__.ObjectSelector" -> "param.__init__.Selector" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.SelectorBase" [URL="#param.__init__.SelectorBase",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Parameter whose value must be chosen from a list of possibilities."]; "param.parameterized.Parameter" -> "param.__init__.SelectorBase" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.Series" [URL="#param.__init__.Series",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Parameter whose value is a pandas Series."]; "param.__init__.ClassSelector" -> "param.__init__.Series" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.Time" [URL="#param.__init__.Time",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A callable object returning a number for the current time."]; "param.parameterized.Parameterized" -> "param.__init__.Time" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.Tuple" [URL="#param.__init__.Tuple",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A tuple Parameter (e.g. ('a',7.6,[3,5])) with a fixed tuple length."]; "param.parameterized.Parameter" -> "param.__init__.Tuple" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.XYCoordinates" [URL="#param.__init__.XYCoordinates",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A NumericTuple for an X,Y coordinate."]; "param.__init__.NumericTuple" -> "param.__init__.XYCoordinates" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.normalize_path" [URL="#param.__init__.normalize_path",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Convert a UNIX-style path to the current OS's format,"]; "param.parameterized.ParameterizedFunction" -> "param.__init__.normalize_path" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.__init__.resolve_path" [URL="#param.__init__.resolve_path",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Find the path to an existing file, searching the paths specified"]; "param.parameterized.ParameterizedFunction" -> "param.__init__.resolve_path" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.parameterized.Parameter" [URL="#param.parameterized.Parameter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An attribute descriptor for declaring parameters."]; "param.parameterized.Parameterized" [URL="#param.parameterized.Parameterized",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="params(name=String)"]; "param.parameterized.ParameterizedFunction" [URL="#param.parameterized.ParameterizedFunction",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="params(name=String)"]; "param.parameterized.Parameterized" -> "param.parameterized.ParameterizedFunction" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

Parameters are a kind of class attribute allowing special behavior, including dynamically generated parameter values, documentation strings, constant and read-only parameters, and type or range checking at assignment time.

Potentially useful for any large Python program that needs user-modifiable object attributes; see the Parameter and Parameterized classes for more information. If you do not want to add a dependency on external code by importing from a separately installed param package, you can simply save this file as param.py and copy it and parameterized.py directly into your own package.

This file contains subclasses of Parameter, implementing specific parameter types (e.g. Number), and also imports the definition of Parameters and Parameterized classes.

class param.__init__.Action(default=None, doc=None, label=None, precedence=None, instantiate=False, constant=False, readonly=False, pickle_default_value=True, allow_None=False, per_instance=True)[source]

A user-provided function that can be invoked like a class or object method using (). In a GUI, this might be mapped to a button, but it can be invoked directly as well.

classmethod deserialize(value)

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

classmethod serialize(value)

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

class param.__init__.Array(default=None, **params)[source]

Parameter whose value is a numpy array.

classmethod deserialize(value)[source]

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

get_range()

Return the possible types for this parameter’s value.

(I.e. return {name: <class>} for all classes that are concrete_descendents() of self.class_.)

Only classes from modules that have been imported are added (see concrete_descendents()).

classmethod serialize(value)[source]

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

class param.__init__.Boolean(default=False, bounds=(0, 1), **params)[source]

Binary or tristate Boolean Parameter.

classmethod deserialize(value)

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

classmethod serialize(value)

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

class param.__init__.CalendarDate(default=None, **kwargs)[source]

CalendarDate parameter of date type.

crop_to_bounds(val)

Return the given value cropped to be within the hard bounds for this parameter.

If a numeric value is passed in, check it is within the hard bounds. If it is larger than the high bound, return the high bound. If it’s smaller, return the low bound. In either case, the returned value could be None. If a non-numeric value is passed in, set to be the default value (which could be None). In no case is an exception raised; all values are accepted.

classmethod deserialize(value)[source]

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

get_soft_bounds()

For each soft bound (upper and lower), if there is a defined bound (not equal to None) then it is returned, otherwise it defaults to the hard bound. The hard bound could still be None.

classmethod serialize(value)[source]

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

set_in_bounds(obj, val)

Set to the given value, but cropped to be within the legal bounds. All objects are accepted, and no exceptions will be raised. See crop_to_bounds for details on how cropping is done.

class param.__init__.CalendarDateRange(default=None, bounds=None, softbounds=None, inclusive_bounds=(True, True), **params)[source]

A date range specified as (start_date, end_date).

classmethod deserialize(value)

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

get_soft_bounds()

For each soft bound (upper and lower), if there is a defined bound (not equal to None) then it is returned, otherwise it defaults to the hard bound. The hard bound could still be None.

classmethod serialize(value)

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

class param.__init__.Callable(default=None, doc=None, label=None, precedence=None, instantiate=False, constant=False, readonly=False, pickle_default_value=True, allow_None=False, per_instance=True)[source]

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

A keyword argument instantiate=True should be provided when a function object is used that might have state. On the other hand, regular standalone functions cannot be deepcopied as of Python 2.4, so instantiate must be False for those values.

classmethod deserialize(value)

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

classmethod serialize(value)

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

class param.__init__.ClassSelector(class_, default=None, instantiate=True, is_instance=True, **params)[source]

Parameter allowing selection of either a subclass or an instance of a given set of classes. By default, requires an instance, but if is_instance=False, accepts a class instead. Both class and instance values respect the instantiate slot, though it matters only for is_instance=True.

classmethod deserialize(value)

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

get_range()[source]

Return the possible types for this parameter’s value.

(I.e. return {name: <class>} for all classes that are concrete_descendents() of self.class_.)

Only classes from modules that have been imported are added (see concrete_descendents()).

classmethod serialize(value)

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

class param.__init__.Color(default=None, **kwargs)[source]

Color parameter defined as a hex RGB string with an optional # prefix.

classmethod deserialize(value)

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

classmethod serialize(value)

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

class param.__init__.Composite(attribs=None, **kw)[source]

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

The constructor argument ‘attribs’ takes a list of attribute names, which may or may not be Parameters. Getting the parameter returns a list of the values of the constituents of the composite, in the order specified. Likewise, setting the parameter takes a sequence of values and sets the value of the constituent attributes.

classmethod deserialize(value)

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

classmethod serialize(value)

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

class param.__init__.DataFrame(default=None, rows=None, columns=None, ordered=None, **params)[source]

Parameter whose value is a pandas DataFrame.

The structure of the DataFrame can be constrained by the rows and columns arguments:

rows: If specified, may be a number or an integer bounds tuple to constrain the allowable number of rows.

columns: If specified, may be a number, an integer bounds tuple, a list or a set. If the argument is numeric, constrains the number of columns using the same semantics as used for rows. If either a list or set of strings, the column names will be validated. If a set is used, the supplied DataFrame must contain the specified columns and if a list is given, the supplied DataFrame must contain exactly the same columns and in the same order and no other columns.

classmethod deserialize(value)[source]

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

get_range()

Return the possible types for this parameter’s value.

(I.e. return {name: <class>} for all classes that are concrete_descendents() of self.class_.)

Only classes from modules that have been imported are added (see concrete_descendents()).

classmethod serialize(value)[source]

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

class param.__init__.Date(default=None, **kwargs)[source]

Date parameter of datetime or date type.

crop_to_bounds(val)

Return the given value cropped to be within the hard bounds for this parameter.

If a numeric value is passed in, check it is within the hard bounds. If it is larger than the high bound, return the high bound. If it’s smaller, return the low bound. In either case, the returned value could be None. If a non-numeric value is passed in, set to be the default value (which could be None). In no case is an exception raised; all values are accepted.

classmethod deserialize(value)[source]

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

get_soft_bounds()

For each soft bound (upper and lower), if there is a defined bound (not equal to None) then it is returned, otherwise it defaults to the hard bound. The hard bound could still be None.

classmethod serialize(value)[source]

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

set_in_bounds(obj, val)

Set to the given value, but cropped to be within the legal bounds. All objects are accepted, and no exceptions will be raised. See crop_to_bounds for details on how cropping is done.

class param.__init__.DateRange(default=None, bounds=None, softbounds=None, inclusive_bounds=(True, True), **params)[source]

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

Bounds must be specified as datetime or date types (see param.dt_types).

classmethod deserialize(value)

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

get_soft_bounds()

For each soft bound (upper and lower), if there is a defined bound (not equal to None) then it is returned, otherwise it defaults to the hard bound. The hard bound could still be None.

classmethod serialize(value)

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

class param.__init__.Dict(default=None, **params)[source]

Parameter whose value is a dictionary.

classmethod deserialize(value)

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

get_range()

Return the possible types for this parameter’s value.

(I.e. return {name: <class>} for all classes that are concrete_descendents() of self.class_.)

Only classes from modules that have been imported are added (see concrete_descendents()).

classmethod serialize(value)

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

class param.__init__.Dynamic(**params)[source]

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

If a Parameter is declared as Dynamic, it can be set a callable object (such as a function or callable class), and getting the parameter’s value will call that callable.

Note that at present, the callable object must allow attributes to be set on itself.

[Python 2.4 limitation: the callable object must be an instance of a callable class, rather than a named function or a lambda function, otherwise the object will not be picklable or deepcopyable.]

If set as time_dependent, setting the Dynamic.time_fn allows the production of dynamic values to be controlled: a new value will be produced only if the current value of time_fn is different from what it was the last time the parameter value was requested.

By default, the Dynamic parameters are not time_dependent so that new values are generated on every call regardless of the time. The default time_fn used when time_dependent is a single Time instance that allows general manipulations of time. It may be set to some other callable as required so long as a number is returned on each call.

classmethod deserialize(value)

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

classmethod serialize(value)

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

class param.__init__.Event(default=False, bounds=(0, 1), **params)[source]

An Event Parameter is one whose value is intimately linked to the triggering of events for watchers to consume. Event has a Boolean value, which when set to True triggers the associated watchers (as any Parameter does) and then is automatically set back to False. Conversely, if events are triggered directly via .trigger, the value is transiently set to True (so that it’s clear which of many parameters being watched may have changed), then restored to False when the triggering completes. An Event parameter is thus like a momentary switch or pushbutton with a transient True value that serves only to launch some other action (e.g. via a param.depends decorator), rather than encapsulating the action itself as param.Action does.

classmethod deserialize(value)

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

classmethod serialize(value)

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

class param.__init__.FileSelector(default=None, path='', **kwargs)[source]

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

compute_default()

If this parameter’s compute_default_fn is callable, call it and store the result in self.default.

Also removes None from the list of objects (if the default is no longer None).

classmethod deserialize(value)

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

get_range()[source]

Return the possible objects to which this parameter could be set.

(Returns the dictionary {object.name:object}.)

classmethod serialize(value)

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

class param.__init__.Filename(default=None, search_paths=None, **params)[source]

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

The string should be specified in UNIX style, but it will be returned in the format of the user’s operating system.

The specified path can be absolute, or relative to either:

• any of the paths specified in the search_paths attribute (if search_paths is not None);

or

• any of the paths searched by resolve_path() (if search_paths is None).

classmethod deserialize(value)

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

classmethod serialize(value)

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

class param.__init__.Foldername(default=None, search_paths=None, **params)[source]

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

The string should be specified in UNIX style, but it will be returned in the format of the user’s operating system.

The specified path can be absolute, or relative to either:

• any of the paths specified in the search_paths attribute (if search_paths is not None);

or

• any of the paths searched by resolve_dir_path() (if search_paths is None).

classmethod deserialize(value)

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

classmethod serialize(value)

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

class param.__init__.HookList(default=[], class_=None, instantiate=True, bounds=(0, None), **params)[source]

Parameter whose value is a list of callable objects.

This type of List Parameter is typically used to provide a place for users to register a set of commands to be called at a specified place in some sequence of processing steps.

classmethod deserialize(value)

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

classmethod serialize(value)

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

class param.__init__.Infinity[source]

Bases: object

An instance of this class represents an infinite value. Unlike Python’s float(‘inf’) value, this object can be safely compared with gmpy numeric types across different gmpy versions.

All operators on Infinity() return Infinity(), apart from the comparison and equality operators. Equality works by checking whether the two objects are both instances of this class.

class param.__init__.Integer(default=0, **params)[source]

Numeric Parameter required to be an Integer

crop_to_bounds(val)

Return the given value cropped to be within the hard bounds for this parameter.

If a numeric value is passed in, check it is within the hard bounds. If it is larger than the high bound, return the high bound. If it’s smaller, return the low bound. In either case, the returned value could be None. If a non-numeric value is passed in, set to be the default value (which could be None). In no case is an exception raised; all values are accepted.

classmethod deserialize(value)

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

get_soft_bounds()

For each soft bound (upper and lower), if there is a defined bound (not equal to None) then it is returned, otherwise it defaults to the hard bound. The hard bound could still be None.

classmethod serialize(value)

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

set_in_bounds(obj, val)

Set to the given value, but cropped to be within the legal bounds. All objects are accepted, and no exceptions will be raised. See crop_to_bounds for details on how cropping is done.

class param.__init__.List(default=[], class_=None, instantiate=True, bounds=(0, None), **params)[source]

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

The bounds allow a minimum and/or maximum length of list to be enforced. If the class is non-None, all items in the list are checked to be of that type.

classmethod deserialize(value)

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

classmethod serialize(value)

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

class param.__init__.ListSelector(default=None, objects=None, instantiate=False, compute_default_fn=None, check_on_set=None, allow_None=None, **params)[source]

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

compute_default()[source]

If this parameter’s compute_default_fn is callable, call it and store the result in self.default.

Also removes None from the list of objects (if the default is no longer None).

classmethod deserialize(value)

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

get_range()

Return the possible objects to which this parameter could be set.

(Returns the dictionary {object.name:object}.)

classmethod serialize(value)

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

class param.__init__.Magnitude(default=1.0, softbounds=None, **params)[source]

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

crop_to_bounds(val)

Return the given value cropped to be within the hard bounds for this parameter.

If a numeric value is passed in, check it is within the hard bounds. If it is larger than the high bound, return the high bound. If it’s smaller, return the low bound. In either case, the returned value could be None. If a non-numeric value is passed in, set to be the default value (which could be None). In no case is an exception raised; all values are accepted.

classmethod deserialize(value)

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

get_soft_bounds()

For each soft bound (upper and lower), if there is a defined bound (not equal to None) then it is returned, otherwise it defaults to the hard bound. The hard bound could still be None.

classmethod serialize(value)

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

set_in_bounds(obj, val)

Set to the given value, but cropped to be within the legal bounds. All objects are accepted, and no exceptions will be raised. See crop_to_bounds for details on how cropping is done.

class param.__init__.MultiFileSelector(default=None, path='', **kwargs)[source]

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

compute_default()

If this parameter’s compute_default_fn is callable, call it and store the result in self.default.

Also removes None from the list of objects (if the default is no longer None).

classmethod deserialize(value)

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

get_range()[source]

Return the possible objects to which this parameter could be set.

(Returns the dictionary {object.name:object}.)

classmethod serialize(value)

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

class param.__init__.Number(default=0.0, bounds=None, softbounds=None, inclusive_bounds=(True, True), step=None, **params)[source]

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

There are two types of bounds: bounds and softbounds. bounds are hard bounds: the parameter must have a value within the specified range. The default bounds are (None,None), meaning there are actually no hard bounds. One or both bounds can be set by specifying a value (e.g. bounds=(None,10) means there is no lower bound, and an upper bound of 10). Bounds are inclusive by default, but exclusivity can be specified for each bound by setting inclusive_bounds (e.g. inclusive_bounds=(True,False) specifies an exclusive upper bound).

Number is also a type of Dynamic parameter, so its value can be set to a callable to get a dynamically generated number (see Dynamic).

When not being dynamically generated, bounds are checked when a Number is created or set. Using a default value outside the hard bounds, or one that is not numeric, results in an exception. When being dynamically generated, bounds are checked when the value of a Number is requested. A generated value that is not numeric, or is outside the hard bounds, results in an exception.

As a special case, if allow_None=True (which is true by default if the parameter has a default of None when declared) then a value of None is also allowed.

A separate function set_in_bounds() is provided that will silently crop the given value into the legal range, for use in, for instance, a GUI.

softbounds are present to indicate the typical range of the parameter, but are not enforced. Setting the soft bounds allows, for instance, a GUI to know what values to display on sliders for the Number.

Example of creating a Number:

AB = Number(default=0.5, bounds=(None,10), softbounds=(0,1), doc='Distance from A to B.')

crop_to_bounds(val)[source]

Return the given value cropped to be within the hard bounds for this parameter.

If a numeric value is passed in, check it is within the hard bounds. If it is larger than the high bound, return the high bound. If it’s smaller, return the low bound. In either case, the returned value could be None. If a non-numeric value is passed in, set to be the default value (which could be None). In no case is an exception raised; all values are accepted.

classmethod deserialize(value)

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

get_soft_bounds()[source]

For each soft bound (upper and lower), if there is a defined bound (not equal to None) then it is returned, otherwise it defaults to the hard bound. The hard bound could still be None.

classmethod serialize(value)

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

set_in_bounds(obj, val)[source]

Set to the given value, but cropped to be within the legal bounds. All objects are accepted, and no exceptions will be raised. See crop_to_bounds for details on how cropping is done.

class param.__init__.NumericTuple(default=(0, 0), length=None, **params)[source]

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

classmethod deserialize(value)

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

classmethod serialize(value)

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

class param.__init__.ObjectSelector(default=None, objects=None, instantiate=False, compute_default_fn=None, check_on_set=None, allow_None=None, **params)[source]

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

check_on_set restricts the value to be among the current list of objects. By default, if objects are initially supplied, check_on_set is True, whereas if no objects are initially supplied, check_on_set is False. This can be overridden by explicitly specifying check_on_set initially.

If check_on_set is True (either because objects are supplied initially, or because it is explicitly specified), the default (initial) value must be among the list of objects (unless the default value is None).

The list of objects can be supplied as a list (appropriate for selecting among a set of strings, or among a set of objects with a “name” parameter), or as a (preferably ordered) dictionary from names to objects. If a dictionary is supplied, the objects will need to be hashable so that their names can be looked up from the object value.

compute_default()[source]

If this parameter’s compute_default_fn is callable, call it and store the result in self.default.

Also removes None from the list of objects (if the default is no longer None).

classmethod deserialize(value)

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

get_range()[source]

Return the possible objects to which this parameter could be set.

(Returns the dictionary {object.name:object}.)

classmethod serialize(value)

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

class param.__init__.Path(default=None, search_paths=None, **params)[source]

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

The string should be specified in UNIX style, but it will be returned in the format of the user’s operating system. Please use the Filename or Foldername classes if you require discrimination between the two possibilities.

The specified path can be absolute, or relative to either:

• any of the paths specified in the search_paths attribute (if search_paths is not None);

or

• any of the paths searched by resolve_path() (if search_paths is None).

classmethod deserialize(value)

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

classmethod serialize(value)

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

class param.__init__.Range(default=None, bounds=None, softbounds=None, inclusive_bounds=(True, True), **params)[source]

A numeric range with optional bounds and softbounds

classmethod deserialize(value)

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

get_soft_bounds()[source]

For each soft bound (upper and lower), if there is a defined bound (not equal to None) then it is returned, otherwise it defaults to the hard bound. The hard bound could still be None.

classmethod serialize(value)

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

class param.__init__.Selector(objects=None, default=None, instantiate=False, compute_default_fn=None, check_on_set=None, allow_None=None, **params)[source]

A more user friendly ObjectSelector that picks the first object for the default (by default) given an ordered data collection. As the first argument is now objects, this can be passed in as a positional argument which sufficient in many common use cases.

compute_default()

If this parameter’s compute_default_fn is callable, call it and store the result in self.default.

Also removes None from the list of objects (if the default is no longer None).

classmethod deserialize(value)

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

get_range()

Return the possible objects to which this parameter could be set.

(Returns the dictionary {object.name:object}.)

classmethod serialize(value)

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

class param.__init__.SelectorBase(default=None, doc=None, label=None, precedence=None, instantiate=False, constant=False, readonly=False, pickle_default_value=True, allow_None=False, per_instance=True)[source]

Parameter whose value must be chosen from a list of possibilities.

Subclasses must implement get_range().

classmethod deserialize(value)

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

classmethod serialize(value)

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

class param.__init__.Series(default=None, rows=None, **params)[source]

Parameter whose value is a pandas Series.

The structure of the Series can be constrained by the rows argument which may be a number or an integer bounds tuple to constrain the allowable number of rows.

classmethod deserialize(value)

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

get_range()

Return the possible types for this parameter’s value.

(I.e. return {name: <class>} for all classes that are concrete_descendents() of self.class_.)

Only classes from modules that have been imported are added (see concrete_descendents()).

classmethod serialize(value)

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

class param.__init__.Time(**params)[source]

A callable object returning a number for the current time.

Here ‘time’ is an abstract concept that can be interpreted in any useful way. For instance, in a simulation, it would be the current simulation time, while in a turn-taking game it could be the number of moves so far. The key intended usage is to allow independent Parameterized objects with Dynamic parameters to remain consistent with a global reference.

The time datatype (time_type) is configurable, but should typically be an exact numeric type like an integer or a rational, so that small floating-point errors do not accumulate as time is incremented repeatedly.

When used as a context manager using the ‘with’ statement (implemented by the __enter__ and __exit__ special methods), entry into a context pushes the state of the Time object, allowing the effect of changes to the time value to be explored by setting, incrementing or decrementing time as desired. This allows the state of time-dependent objects to be modified temporarily as a function of time, within the context’s block. For instance, you could use the context manager to “see into the future” to collect data over multiple times, without affecting the global time state once exiting the context. Of course, you need to be careful not to do anything while in context that would affect the lasting state of your other objects, if you want things to return to their starting state when exiting the context.

The starting time value of a new Time object is 0, converted to the chosen time type. Here is an illustration of how time can be manipulated using a Time object:

>>> time = Time(until=20, timestep=1)
>>> 'The initial time is %s' % time()
'The initial time is 0'
>>> 'Setting the time to %s' % time(5)
'Setting the time to 5'
>>> time += 5
>>> 'After incrementing by 5, the time is %s' % time()
'After incrementing by 5, the time is 10'
>>> with time as t:  # Entering a context
...     'Time before iteration: %s' % t()
...     'Iteration: %s' % [val for val in t]
...     'Time after iteration: %s' % t()
...     t += 2
...     'The until parameter may be exceeded outside iteration: %s' % t()
'Time before iteration: 10'
'Iteration: [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]'
'Time after iteration: 20'
'The until parameter may be exceeded outside iteration: 22'
>>> 'After exiting the context the time is back to %s' % time()
'After exiting the context the time is back to 10'

label = param.String(default=’Time’)

The label given to the Time object. Can be used to convey more specific notions of time as appropriate. For instance, the label could be ‘Simulation Time’ or ‘Duration’.

time_type = param.Parameter(default=<class ‘int’>)

Callable that Time will use to convert user-specified time values into the current time; all times will be of the resulting numeric type. By default, time is of integer type, but you can supply any arbitrary-precision type like a fixed-point decimal or a rational, to allow fractional times. Floating-point times are also allowed, but are not recommended because they will suffer from accumulated rounding errors. For instance, incrementing a floating-point value 0.0 by 0.05, 20 times, will not reach 1.0 exactly. Instead, it will be slightly higher than 1.0, because 0.05 cannot be represented exactly in a standard floating point numeric type. Fixed-point or rational types should be able to handle such computations exactly, avoiding accumulation issues over long time intervals. Some potentially useful exact number classes: - int: Suitable if all times can be expressed as integers. - Python’s decimal.Decimal and fractions.Fraction classes: widely available but slow and also awkward to specify times (e.g. cannot simply type 0.05, but have to use a special constructor or a string). - fixedpoint.FixedPoint: Allows a natural representation of times in decimal notation, but very slow and needs to be installed separately. - gmpy.mpq: Allows a natural representation of times in decimal notation, and very fast because it uses the GNU Multi-Precision library, but needs to be installed separately and depends on a non-Python library. gmpy.mpq is gmpy’s rational type.

timestep = param.Parameter(default=1.0)

Stepsize to be used with the iterator interface. Time can be advanced or decremented by any value, not just those corresponding to the stepsize, and so this value is only a default.

until = param.Parameter(default=Infinity())

Declaration of an expected end to time values, if any. When using the iterator interface, iteration will end before this value is exceeded.

unit = param.String()

The units of the time dimensions. The default of None is set as the global time function may on an arbitrary time base. Typical values for the parameter are ‘seconds’ (the SI unit for time) or subdivisions thereof (e.g. ‘milliseconds’).

debug(**kwargs)

Inspect .param.debug method for the full docstring

defaults(**kwargs)

Inspect .param.defaults method for the full docstring

force_new_dynamic_value(**kwargs)

Inspect .param.force_new_dynamic_value method for the full docstring

get_param_values(**kwargs)

Inspect .param.get_param_values method for the full docstring

get_value_generator(**kwargs)

Inspect .param.get_value_generator method for the full docstring

inspect_value(**kwargs)

Inspect .param.inspect_value method for the full docstring

message(**kwargs)

Inspect .param.message method for the full docstring

params(**kwargs)

Inspect .param.params method for the full docstring

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults(*args, **kwargs)

Inspect .param.print_param_defaults method for the full docstring

print_param_values(**kwargs)

Inspect .param.print_param_values method for the full docstring

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

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(*args, **kwargs)

Inspect .param.set_default method for the full docstring

set_dynamic_time_fn(**kwargs)

Inspect .param.set_dynamic_time_fn method for the full docstring

set_param(**kwargs)

Inspect .param.set_param method for the full docstring

state_pop()

Restore the most recently saved state.

See state_push() for more details.

state_push()

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

time_type

alias of int

verbose(**kwargs)

Inspect .param.verbose method for the full docstring

warning(**kwargs)

Inspect .param.warning method for the full docstring

class param.__init__.Tuple(default=(0, 0), length=None, **params)[source]

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

classmethod deserialize(value)[source]

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

classmethod serialize(value)[source]

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

class param.__init__.XYCoordinates(default=(0.0, 0.0), **params)[source]

A NumericTuple for an X,Y coordinate.

classmethod deserialize(value)

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

classmethod serialize(value)

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

param.__init__.abbreviate_paths(pathspec, named_paths)[source]

Given a dict of (pathname,path) pairs, removes any prefix shared by all pathnames. Helps keep menu items short yet unambiguous.

param.__init__.as_unicode(obj)[source]

Safely casts any object to unicode including regular string (i.e. bytes) types in python 2.

param.__init__.concrete_descendents(parentclass)[source]

Return a dictionary containing all subclasses of the specified parentclass, including the parentclass. Only classes that are defined in scripts that have been run or modules that have been imported are included, so the caller will usually first do from package import *.

Only non-abstract classes will be included.

param.__init__.guess_bounds(params, **overrides)[source]

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

If given a set of override keywords, use those numeric tuple bounds.

param.__init__.guess_param_types(**kwargs)[source]

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

param.__init__.hashable(x)[source]

Return a hashable version of the given object x, with lists and dictionaries converted to tuples. Allows mutable objects to be used as a lookup key in cases where the object has not actually been mutated. Lookup will fail (appropriately) in cases where some part of the object has changed. Does not (currently) recursively replace mutable subobjects.

param.__init__.is_ordered_dict(d)[source]

Predicate checking for ordered dictionaries. OrderedDict is always ordered, and vanilla Python dictionaries are ordered for Python 3.6+

param.__init__.main = Parameterized(name='main')

Top-level object to allow messaging not tied to a particular Parameterized object, as in ‘param.main.warning(“Invalid option”)’.

param.__init__.named_objs(objlist, namesdict=None)[source]

Given a list of objects, returns a dictionary mapping from string name for the object to the object itself. Accepts an optional name,obj dictionary, which will override any other name if that item is present in the dictionary.

class param.__init__.normalize_path(*args, **params)[source]

Convert a UNIX-style path to the current OS’s format, typically for creating a new file or directory.

If the path is not already absolute, it will be made absolute (using the prefix parameter).

Should do the same as Python’s os.path.abspath(), except using prefix rather than os.getcwd).

prefix = param.String(default=’/home/runner/work/param/param’)

Prepended to the specified path, if that path is not absolute.

debug(**kwargs)

Inspect .param.debug method for the full docstring

defaults(**kwargs)

Inspect .param.defaults method for the full docstring

force_new_dynamic_value(**kwargs)

Inspect .param.force_new_dynamic_value method for the full docstring

get_param_values(**kwargs)

Inspect .param.get_param_values method for the full docstring

get_value_generator(**kwargs)

Inspect .param.get_value_generator method for the full docstring

inspect_value(**kwargs)

Inspect .param.inspect_value method for the full docstring

instance(**params)

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

message(**kwargs)

Inspect .param.message method for the full docstring

params(**kwargs)

Inspect .param.params method for the full docstring

pprint(imports=None, prefix='\n ', unknown_value='<?>', qualify=False, separator='')

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

classmethod print_param_defaults(*args, **kwargs)

Inspect .param.print_param_defaults method for the full docstring

print_param_values(**kwargs)

Inspect .param.print_param_values method for the full docstring

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

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

classmethod set_default(*args, **kwargs)

Inspect .param.set_default method for the full docstring

set_dynamic_time_fn(**kwargs)

Inspect .param.set_dynamic_time_fn method for the full docstring

set_param(**kwargs)

Inspect .param.set_param method for the full docstring

state_pop()

Restore the most recently saved state.

See state_push() for more details.

state_push()

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

verbose(**kwargs)

Inspect .param.verbose method for the full docstring

warning(**kwargs)

Inspect .param.warning method for the full docstring

param.__init__.param_union(*parameterizeds, **kwargs)[source]

Given a set of Parameterized objects, returns a dictionary with the union of all param name,value pairs across them. If warn is True (default), warns if the same parameter has been given multiple values; otherwise uses the last value

param.__init__.parameterized_class(name, params, bases=<class 'param.parameterized.Parameterized'>)[source]

Dynamically create a parameterized class with the given name and the supplied parameters, inheriting from the specified base(s).

param.__init__.produce_value(value_obj)[source]

A helper function that produces an actual parameter from a stored object: if the object is callable, call it, otherwise return the object.

class param.__init__.resolve_path(*args, **params)[source]

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.

To turn a supplied relative path into an absolute one, the path is appended to paths in the search_paths parameter, in order, until the file is found.

Similar to Python’s os.path.abspath(), except more search paths than just os.getcwd() can be used, and the file must exist.

search_paths = param.List(bounds=(0, None), default=[‘/home/runner/work/param/param’])

Prepended to a non-relative path, in order, until a file is found.

path_to_file = param.Boolean(bounds=(0, 1), default=True)

String specifying whether the path refers to a ‘File’ or a ‘Folder’.

debug(**kwargs)

Inspect .param.debug method for the full docstring

defaults(**kwargs)

Inspect .param.defaults method for the full docstring

force_new_dynamic_value(**kwargs)

Inspect .param.force_new_dynamic_value method for the full docstring

get_param_values(**kwargs)

Inspect .param.get_param_values method for the full docstring

get_value_generator(**kwargs)

Inspect .param.get_value_generator method for the full docstring

inspect_value(**kwargs)

Inspect .param.inspect_value method for the full docstring

instance(**params)

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

message(**kwargs)

Inspect .param.message method for the full docstring

params(**kwargs)

Inspect .param.params method for the full docstring

pprint(imports=None, prefix='\n ', unknown_value='<?>', qualify=False, separator='')

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

classmethod print_param_defaults(*args, **kwargs)

Inspect .param.print_param_defaults method for the full docstring

print_param_values(**kwargs)

Inspect .param.print_param_values method for the full docstring

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

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

classmethod set_default(*args, **kwargs)

Inspect .param.set_default method for the full docstring

set_dynamic_time_fn(**kwargs)

Inspect .param.set_dynamic_time_fn method for the full docstring

set_param(**kwargs)

Inspect .param.set_param method for the full docstring

state_pop()

Restore the most recently saved state.

See state_push() for more details.

state_push()

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

verbose(**kwargs)

Inspect .param.verbose method for the full docstring

warning(**kwargs)

Inspect .param.warning method for the full docstring

## ipython Module¶

digraph inheritance6c9d819611 { bgcolor=transparent; fontsize=18; rankdir=LR; size="12.0, 12.0"; "param.ipython.ParamPager" [URL="#param.ipython.ParamPager",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Callable class that displays information about the supplied"]; }

Optional IPython extension for working with Parameters.

This extension offers extended but completely optional functionality for IPython users. From within IPython, it may be loaded using:

This will register the %params line magic to allow easy inspection of all the parameters defined on a parameterized class or object:

%params <parameterized class or object>

All parameters of the class or object will be listed in the IPython pager together with all their corresponding attributes and docstrings. Note that the class or object to be inspected must already exist in the active namespace.

class param.ipython.ParamPager(metaclass=False)[source]

Bases: object

Callable class that displays information about the supplied Parameterized object or class in the IPython pager.

get_param_info(obj, include_super=True)[source]

Get the parameter dictionary, the list of modifed parameters and the dictionary or parameter values. If include_super is True, parameters are also collected from the super classes.

param_docstrings(info, max_col_len=100, only_changed=False)[source]

Build a string to that presents all of the parameter docstrings in a clean format (alternating red and blue for readability).

## parameterized Module¶

digraph inheritancece7b6403e7 { bgcolor=transparent; fontsize=18; rankdir=LR; size="12.0, 12.0"; "param.parameterized.Comparator" [URL="#param.parameterized.Comparator",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Comparator defines methods for determining whether two objects"]; "param.parameterized.Event" [URL="#param.parameterized.Event",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Event(what, name, obj, cls, old, new, type)"]; "param.parameterized.MInfo" [URL="#param.parameterized.MInfo",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="MInfo(inst, cls, name, method)"]; "param.parameterized.PInfo" [URL="#param.parameterized.PInfo",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="PInfo(inst, cls, name, pobj, what)"]; "param.parameterized.ParamOverrides" [URL="#param.parameterized.ParamOverrides",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A dictionary that returns the attribute of a specified object if"]; "param.parameterized.Parameter" [URL="#param.parameterized.Parameter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An attribute descriptor for declaring parameters."]; "param.parameterized.ParameterMetaclass" [URL="#param.parameterized.ParameterMetaclass",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Metaclass allowing control over creation of Parameter classes."]; "param.parameterized.Parameterized" [URL="#param.parameterized.Parameterized",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="params(name=String)"]; "param.parameterized.ParameterizedFunction" [URL="#param.parameterized.ParameterizedFunction",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="params(name=String)"]; "param.parameterized.Parameterized" -> "param.parameterized.ParameterizedFunction" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.parameterized.ParameterizedMetaclass" [URL="#param.parameterized.ParameterizedMetaclass",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="The metaclass of Parameterized (and all its descendents)."]; "param.parameterized.Parameters" [URL="#param.parameterized.Parameters",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Object that holds the namespace and implementation of Parameterized"]; "param.parameterized.String" [URL="#param.parameterized.String",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A String Parameter, with a default value and optional regular expression (regex) matching."]; "param.parameterized.Parameter" -> "param.parameterized.String" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.parameterized.Watcher" [URL="#param.parameterized.Watcher",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Watcher(inst, cls, fn, mode, onlychanged, parameter_names, what, queued)"]; "param.parameterized.bothmethod" [URL="#param.parameterized.bothmethod",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="'optional @classmethod'"]; "param.parameterized.default_label_formatter" [URL="#param.parameterized.default_label_formatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="params(capitalize=Parameter, overrides=Parameter, replace_underscores=Parameter, name=String)"]; "param.parameterized.ParameterizedFunction" -> "param.parameterized.default_label_formatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.parameterized.overridable_property" [URL="#param.parameterized.overridable_property",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="The same as Python's \"property\" attribute, but allows the accessor"]; "param.parameterized.shared_parameters" [URL="#param.parameterized.shared_parameters",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Context manager to share parameter instances when creating"]; }

Generic support for objects with full-featured Parameters and messaging.

class param.parameterized.Comparator[source]

Bases: object

Comparator defines methods for determining whether two objects should be considered equal. It works by registering custom comparison functions, which may either be registed by type or with a predicate function. If no matching comparison can be found for the two objects the comparison will return False.

If registered by type the Comparator will check whether both objects are of that type and apply the comparison. If the equality function is instead registered with a function it will call the function with each object individually to check if the comparison applies. This is useful for defining comparisons for objects without explicitly importing them.

To use the Comparator simply call the is_equal function.

class param.parameterized.Event(what, name, obj, cls, old, new, type)

Bases: tuple

property cls

Alias for field number 3

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

property name

Alias for field number 1

property new

Alias for field number 5

property obj

Alias for field number 2

property old

Alias for field number 4

property type

Alias for field number 6

property what

Alias for field number 0

class param.parameterized.MInfo(inst, cls, name, method)

Bases: tuple

property cls

Alias for field number 1

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

property inst

Alias for field number 0

property method

Alias for field number 3

property name

Alias for field number 2

class param.parameterized.PInfo(inst, cls, name, pobj, what)

Bases: tuple

property cls

Alias for field number 1

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

property inst

Alias for field number 0

property name

Alias for field number 2

property pobj

Alias for field number 3

property what

Alias for field number 4

class param.parameterized.ParamOverrides(overridden, dict_, allow_extra_keywords=False)[source]

Bases: dict

A dictionary that returns the attribute of a specified object if that attribute is not present in itself.

Used to override the parameters of an object.

clear() → None. Remove all items from D.
copy() → a shallow copy of D
extra_keywords()[source]

Return a dictionary containing items from the originally supplied dict_ whose names are not parameters of the overridden object.

fromkeys(value=None, /)

Create a new dictionary with keys from iterable and values set to value.

get(key, default=None)[source]

Return the value for key if key is in the dictionary, else default.

items() → a set-like object providing a view on D’s items
keys() → a set-like object providing a view on D’s keys
param_keywords()[source]

Return a dictionary containing items from the originally supplied dict_ whose names are parameters of the overridden object (i.e. not extra keywords/parameters).

pop(k[, d]) → v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised

popitem() → (k, v), remove and return some (key, value) pair as a

2-tuple; but raise KeyError if D is empty.

setdefault(key, default=None, /)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update([E, ]**F) → None. Update D from dict/iterable E and F.

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() → an object providing a view on D’s values
class param.parameterized.Parameter(default=None, doc=None, label=None, precedence=None, instantiate=False, constant=False, readonly=False, pickle_default_value=True, allow_None=False, per_instance=True)[source]

Bases: object

An attribute descriptor for declaring parameters.

Parameters are a special kind of class attribute. Setting a Parameterized class attribute to be a Parameter instance causes that attribute of the class (and the class’s instances) to be treated as a Parameter. This allows special behavior, including dynamically generated parameter values, documentation strings, constant and read-only parameters, and type or range checking at assignment time.

For example, suppose someone wants to define two new kinds of objects Foo and Bar, such that Bar has a parameter delta, Foo is a subclass of Bar, and Foo has parameters alpha, sigma, and gamma (and delta inherited from Bar). She would begin her class definitions with something like this:

class Bar(Parameterized):

delta = Parameter(default=0.6, doc=’The difference between steps.’) …

class Foo(Bar):

alpha = Parameter(default=0.1, doc=’The starting value.’) sigma = Parameter(default=0.5, doc=’The standard deviation.’,

constant=True)

gamma = Parameter(default=1.0, doc=’The ending value.’) …

Class Foo would then have four parameters, with delta defaulting to 0.6.

Parameters have several advantages over plain attributes:

1. Parameters can be set automatically when an instance is constructed: The default constructor for Foo (and Bar) will accept arbitrary keyword arguments, each of which can be used to specify the value of a Parameter of Foo (or any of Foo’s superclasses). E.g., if a script does this:

myfoo = Foo(alpha=0.5)

myfoo.alpha will return 0.5, without the Foo constructor needing special code to set alpha.

If Foo implements its own constructor, keyword arguments will still be accepted if the constructor accepts a dictionary of keyword arguments (as in def __init__(self,**params):), and then each class calls its superclass (as in super(Foo,self).__init__(**params)) so that the Parameterized constructor will process the keywords.

2. A Parameterized class need specify only the attributes of a Parameter whose values differ from those declared in superclasses; the other values will be inherited. E.g. if Foo declares

delta = Parameter(default=0.2)

the default value of 0.2 will override the 0.6 inherited from Bar, but the doc will be inherited from Bar.

3. The Parameter descriptor class can be subclassed to provide more complex behavior, allowing special types of parameters that, for example, require their values to be numbers in certain ranges, generate their values dynamically from a random distribution, or read their values from a file or other external source.

4. The attributes associated with Parameters provide enough information for automatically generating property sheets in graphical user interfaces, allowing Parameterized instances to be edited by users.

Note that Parameters can only be used when set as class attributes of Parameterized classes. Parameters used as standalone objects, or as class attributes of non-Parameterized classes, will not have the behavior described here.

classmethod deserialize(value)[source]

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

classmethod serialize(value)[source]

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

class param.parameterized.ParameterMetaclass(classname, bases, classdict)[source]

Bases: type

Metaclass allowing control over creation of Parameter classes.

mro()

Return a type’s method resolution order.

class param.parameterized.Parameterized(**params)[source]

Bases: object

params(name=String)

Base class for named objects that support Parameters and message formatting.

Automatic object naming: Every Parameterized instance has a name parameter. If the user doesn’t designate a name=<str> argument when constructing the object, the object will be given a name consisting of its class name followed by a unique 5-digit number.

Automatic parameter setting: The Parameterized __init__ method will automatically read the list of keyword parameters. If any keyword matches the name of a Parameter (see Parameter class) defined in the object’s class or any of its superclasses, that parameter in the instance will get the value given as a keyword argument. For example:

class Foo(Parameterized):

xx = Parameter(default=1)

foo = Foo(xx=20)

in this case foo.xx gets the value 20.

When initializing a Parameterized instance (‘foo’ in the example above), the values of parameters can be supplied as keyword arguments to the constructor (using parametername=parametervalue); these values will override the class default values for this one instance.

If no ‘name’ parameter is supplied, self.name defaults to the object’s class name with a unique number appended to it.

Message formatting: Each Parameterized instance has several methods for optionally printing output. This functionality is based on the standard Python ‘logging’ module; using the methods provided here, wraps calls to the ‘logging’ module’s root logger and prepends each message with information about the instance from which the call was made. For more information on how to set the global logging level and change the default message prefix, see documentation for the ‘logging’ module.

[0m Object has no parameters.

debug(**kwargs)[source]

Inspect .param.debug method for the full docstring

defaults(**kwargs)[source]

Inspect .param.defaults method for the full docstring

force_new_dynamic_value(**kwargs)[source]

Inspect .param.force_new_dynamic_value method for the full docstring

get_param_values(**kwargs)[source]

Inspect .param.get_param_values method for the full docstring

get_value_generator(**kwargs)[source]

Inspect .param.get_value_generator method for the full docstring

inspect_value(**kwargs)[source]

Inspect .param.inspect_value method for the full docstring

message(**kwargs)[source]

Inspect .param.message method for the full docstring

params(**kwargs)[source]

Inspect .param.params method for the full docstring

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')[source]

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults(*args, **kwargs)[source]

Inspect .param.print_param_defaults method for the full docstring

print_param_values(**kwargs)[source]

Inspect .param.print_param_values method for the full docstring

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

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(*args, **kwargs)[source]

Inspect .param.set_default method for the full docstring

set_dynamic_time_fn(**kwargs)[source]

Inspect .param.set_dynamic_time_fn method for the full docstring

set_param(**kwargs)[source]

Inspect .param.set_param method for the full docstring

state_pop()[source]

Restore the most recently saved state.

See state_push() for more details.

state_push()[source]

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

verbose(**kwargs)[source]

Inspect .param.verbose method for the full docstring

warning(**kwargs)[source]

Inspect .param.warning method for the full docstring

class param.parameterized.ParameterizedFunction(*args, **params)[source]

params(name=String)

Acts like a Python function, but with arguments that are Parameters.

Implemented as a subclass of Parameterized that, when instantiated, automatically invokes __call__ and returns the result, instead of returning an instance of the class.

To obtain an instance of this class, call instance().

[0m Object has no parameters.

debug(**kwargs)

Inspect .param.debug method for the full docstring

defaults(**kwargs)

Inspect .param.defaults method for the full docstring

force_new_dynamic_value(**kwargs)

Inspect .param.force_new_dynamic_value method for the full docstring

get_param_values(**kwargs)

Inspect .param.get_param_values method for the full docstring

get_value_generator(**kwargs)

Inspect .param.get_value_generator method for the full docstring

inspect_value(**kwargs)

Inspect .param.inspect_value method for the full docstring

instance(**params)[source]

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

message(**kwargs)

Inspect .param.message method for the full docstring

params(**kwargs)

Inspect .param.params method for the full docstring

pprint(imports=None, prefix='\n ', unknown_value='<?>', qualify=False, separator='')[source]

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

classmethod print_param_defaults(*args, **kwargs)

Inspect .param.print_param_defaults method for the full docstring

print_param_values(**kwargs)

Inspect .param.print_param_values method for the full docstring

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

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

classmethod set_default(*args, **kwargs)

Inspect .param.set_default method for the full docstring

set_dynamic_time_fn(**kwargs)

Inspect .param.set_dynamic_time_fn method for the full docstring

set_param(**kwargs)

Inspect .param.set_param method for the full docstring

state_pop()

Restore the most recently saved state.

See state_push() for more details.

state_push()

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

verbose(**kwargs)

Inspect .param.verbose method for the full docstring

warning(**kwargs)

Inspect .param.warning method for the full docstring

class param.parameterized.ParameterizedMetaclass(name, bases, dict_)[source]

Bases: type

The metaclass of Parameterized (and all its descendents).

The metaclass overrides type.__setattr__ to allow us to set Parameter values on classes without overwriting the attribute descriptor. That is, for a Parameterized class of type X with a Parameter y, the user can type X.y=3, which sets the default value of Parameter y to be 3, rather than overwriting y with the constant value 3 (and thereby losing all other info about that Parameter, such as the doc string, bounds, etc.).

The __init__ method is used when defining a Parameterized class, usually when the module where that class is located is imported for the first time. That is, the __init__ in this metaclass initializes the class object, while the __init__ method defined in each Parameterized class is called for each new instance of that class.

Additionally, a class can declare itself abstract by having an attribute __abstract set to True. The ‘abstract’ attribute can be used to find out if a class is abstract or not.

property abstract

Return True if the class has an attribute __abstract set to True. Subclasses will return False unless they themselves have __abstract set to true. This mechanism allows a class to declare itself to be abstract (e.g. to avoid it being offered as an option in a GUI), without the “abstract” property being inherited by its subclasses (at least one of which is presumably not abstract).

get_param_descriptor(param_name)[source]

Goes up the class hierarchy (starting from the current class) looking for a Parameter class attribute param_name. As soon as one is found as a class attribute, that Parameter is returned along with the class in which it is declared.

mro()

Return a type’s method resolution order.

class param.parameterized.Parameters(cls, self=None)[source]

Bases: object

Object that holds the namespace and implementation of Parameterized methods as well as any state that is not in __slots__ or the Parameters themselves.

Exists at both the metaclass level (instantiated by the metaclass) and at the instance level. Can contain state specific to either the class or the instance as necessary.

debug(msg, *args, **kw)[source]

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()[source]

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

classmethod deprecate(fn)[source]

Decorator to issue warnings for API moving onto the param namespace and to add a docstring directing people to the appropriate method.

force_new_dynamic_value(name)[source]

Force a new value to be generated for the dynamic attribute name, and return it.

If name is not dynamic, its current value is returned (i.e. equivalent to getattr(name).

get_param_values(onlychanged=False)[source]

Return a list of name,value pairs for all Parameters of this object.

When called on an instance with onlychanged set to True, will only return values that are not equal to the default value (onlychanged has no effect when called on a class).

get_value_generator(name)[source]

Return the value or value-generating object of the named attribute.

For most parameters, this is simply the parameter’s value (i.e. the same as getattr()), but Dynamic parameters have their value-generating object returned.

inspect_value(name)[source]

Return the current value of the named attribute without modifying it.

Same as getattr() except for Dynamic parameters, which have their last generated value returned.

message(msg, *args, **kw)[source]

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

objects(instance=True)[source]

Returns the Parameters of this instance or class

If instance=True and called on a Parameterized instance it will create instance parameters for all Parameters defined on the class. To force class parameters to be returned use instance=False. Since classes avoid creating instance parameters unless necessary you may also request only existing instance parameters to be returned by setting instance=’existing’.

outputs()[source]

Returns a mapping between any declared outputs and a tuple of the declared Parameter type, the output method, and the index into the output if multiple outputs are returned.

params(parameter_name=None)[source]

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

print_param_defaults()[source]

Print the default values of all cls’s Parameters.

print_param_values()[source]

Print the values of all this object’s Parameters.

schema(safe=False, subset=None, mode='json')[source]

Returns a schema for the parameters on this Parameterized object.

set_default(param_name, value)[source]

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn(time_fn, sublistattr=None)[source]

Set time_fn for all Dynamic Parameters of this class or instance object that are currently being dynamically generated.

Additionally, sets _Dynamic_time_fn=time_fn on this class or instance object, so that any future changes to Dynamic Parmeters can inherit time_fn (e.g. if a Number is changed from a float to a number generator, the number generator will inherit time_fn).

If specified, sublistattr is the name of an attribute of this class or instance that contains an iterable collection of subobjects on which set_dynamic_time_fn should be called. If the attribute sublistattr is present on any of the subobjects, set_dynamic_time_fn() will be called for those, too.

set_param(*args, **kwargs)[source]

For each param=value keyword argument, sets the corresponding parameter of this object or class to the given value.

For backwards compatibility, also accepts set_param(“param”,value) for a single parameter value using positional arguments, but the keyword interface is preferred because it is more compact and can set multiple values.

trigger(*param_names)[source]

Trigger watchers for the given set of parameter names. Watchers will be triggered whether or not the parameter values have actually changed. As a special case, the value will actually be changed for a Parameter of type Event, setting it to True so that it is clear which Event parameter has been triggered.

unwatch(watcher)[source]

Unwatch watchers set either with watch or watch_values.

verbose(msg, *args, **kw)[source]

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)[source]

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class param.parameterized.String(default='', regex=None, allow_None=False, **kwargs)[source]

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

Example of using a regex to implement IPv4 address matching:

class IPAddress(String):
'''IPv4 address as a string (dotted decimal notation)'''
def __init__(self, default="0.0.0.0", allow_None=False, **kwargs):
ip_regex = '^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$' super(IPAddress, self).__init__(default=default, regex=ip_regex, **kwargs)  classmethod deserialize(value) Given a serializable Python value, return a value that the parameter can be set to classmethod serialize(value) Given the parameter value, return a Python value suitable for serialization class param.parameterized.Watcher(inst, cls, fn, mode, onlychanged, parameter_names, what, queued) Bases: tuple property cls Alias for field number 1 count(value, /) Return number of occurrences of value. property fn Alias for field number 2 index(value, start=0, stop=9223372036854775807, /) Return first index of value. Raises ValueError if the value is not present. property inst Alias for field number 0 property mode Alias for field number 3 property onlychanged Alias for field number 4 property parameter_names Alias for field number 5 property queued Alias for field number 7 property what Alias for field number 6 param.parameterized.add_metaclass(metaclass)[source] Class decorator for creating a class with a metaclass. param.parameterized.all_equal(arg1, arg2)[source] Return a single boolean for arg1==arg2, even for numpy arrays using element-wise comparison. Uses all(arg1==arg2) for sequences, and arg1==arg2 otherwise. If both objects have an ‘_infinitely_iterable’ attribute, they are not be zipped together and are compared directly instead. param.parameterized.as_uninitialized(fn)[source] Decorator: call fn with the parameterized_instance’s initialization flag set to False, then revert the flag. (Used to decorate Parameterized methods that must alter a constant Parameter.) param.parameterized.batch_watch(parameterized, enable=True, run=True)[source] Context manager to batch watcher events on a parameterized object. The context manager will queue any events triggered by setting a parameter on the supplied parameterized object and dispatch them all at once when the context manager exits. If run=False the queued events are not dispatched and should be processed manually. class param.parameterized.bothmethod(func)[source] Bases: object ‘optional @classmethod’ A decorator that allows a method to receive either the class object (if called on the class) or the instance object (if called on the instance) as its first argument. Code (but not documentation) copied from: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/523033. param.parameterized.classlist(class_)[source] Return a list of the class hierarchy above (and including) the given class. Same as inspect.getmro(class_)[::-1] param.parameterized.dbprint_prefix = None If not None, the value of this Parameter will be called (using ‘()’) before every call to __db_print, and is expected to evaluate to a string that is suitable for prefixing messages and warnings (such as some indicator of the global state). class param.parameterized.default_label_formatter(*args, **params)[source] params(capitalize=Parameter, overrides=Parameter, replace_underscores=Parameter, name=String) Default formatter to turn parameter names into appropriate widget labels. [1;32mParameters of ‘default_label_formatter’ ======================================= [0m [1;31mParameters changed from their default values are marked in red.[0m [1;36mSoft bound values are marked in cyan.[0m C/V= Constant/Variable, RO/RW = ReadOnly/ReadWrite, AN=Allow None [1;34mName Value Type Mode [0m capitalize True Parameter V RW overrides {} Parameter V RW replace_underscores True Parameter V RW [1;32mParameter docstrings: =====================[0m [1;34mcapitalize: Whether or not the label should be capitalized.[0m [1;31moverrides: Allows custom labels to be specified for specific parameter[0m [1;31m names using a dictionary where key is the parameter name and the[0m [1;31m value is the desired label.[0m [1;34mreplace_underscores: Whether or not underscores should be replaced with spaces.[0m capitalize = param.Parameter(default=True) Whether or not the label should be capitalized. replace_underscores = param.Parameter(default=True) Whether or not underscores should be replaced with spaces. overrides = param.Parameter(default={}) Allows custom labels to be specified for specific parameter names using a dictionary where key is the parameter name and the value is the desired label. debug(**kwargs) Inspect .param.debug method for the full docstring defaults(**kwargs) Inspect .param.defaults method for the full docstring force_new_dynamic_value(**kwargs) Inspect .param.force_new_dynamic_value method for the full docstring get_param_values(**kwargs) Inspect .param.get_param_values method for the full docstring get_value_generator(**kwargs) Inspect .param.get_value_generator method for the full docstring inspect_value(**kwargs) Inspect .param.inspect_value method for the full docstring instance(**params) Return an instance of this class, copying parameters from any existing instance provided. message(**kwargs) Inspect .param.message method for the full docstring params(**kwargs) Inspect .param.params method for the full docstring pprint(imports=None, prefix='\n ', unknown_value='<?>', qualify=False, separator='') Same as Parameterized.pprint, except that X.classname(Y is replaced with X.classname.instance(Y classmethod print_param_defaults(*args, **kwargs) Inspect .param.print_param_defaults method for the full docstring print_param_values(**kwargs) Inspect .param.print_param_values method for the full docstring script_repr(imports=[], prefix=' ') Same as Parameterized.script_repr, except that X.classname(Y is replaced with X.classname.instance(Y classmethod set_default(*args, **kwargs) Inspect .param.set_default method for the full docstring set_dynamic_time_fn(**kwargs) Inspect .param.set_dynamic_time_fn method for the full docstring set_param(**kwargs) Inspect .param.set_param method for the full docstring state_pop() Restore the most recently saved state. See state_push() for more details. state_push() Save this instance’s state. For Parameterized instances, this includes the state of dynamically generated values. Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop(). Generally, this method is used by operations that need to test something without permanently altering the objects’ state. verbose(**kwargs) Inspect .param.verbose method for the full docstring warning(**kwargs) Inspect .param.warning method for the full docstring param.parameterized.depends(func, *dependencies, **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. param.parameterized.descendents(class_)[source] Return a list of the class hierarchy below (and including) the given class. The list is ordered from least- to most-specific. Can be useful for printing the contents of an entire class hierarchy. param.parameterized.discard_events(parameterized)[source] Context manager that discards any events within its scope triggered on the supplied parameterized object. param.parameterized.edit_constant(parameterized)[source] Temporarily set parameters on Parameterized object to constant=False to allow editing them. param.parameterized.get_all_slots(class_)[source] Return a list of slot names for slots defined in class_ and its superclasses. param.parameterized.get_method_owner(method)[source] Gets the instance that owns the supplied method param.parameterized.get_occupied_slots(instance)[source] Return a list of slots for which values have been set. (While a slot might be defined, if a value for that slot hasn’t been set, then it’s an AttributeError to request the slot’s value.) param.parameterized.iscoroutinefunction(function)[source] Whether the function is an asynchronous coroutine function. param.parameterized.label_formatter param.parameterized.logging_level(level)[source] Temporarily modify param’s logging level. param.parameterized.no_instance_params(cls)[source] Disables instance parameters on the class param.parameterized.output(func, *output, **kw)[source] output allows annotating a method on a Parameterized class to declare that it returns an output of a specific type. The outputs of a Parameterized class can be queried using the Parameterized.param.outputs method. By default the output will inherit the method name but a custom name can be declared by expressing the Parameter type using a keyword argument. Declaring multiple return types using keywords is only supported in Python >= 3.6. The simplest declaration simply declares the method returns an object without any type guarantees, e.g.: @output() If a specific parameter type is specified this is a declaration that the method will return a value of that type, e.g.: @output(param.Number()) To override the default name of the output the type may be declared as a keyword argument, e.g.: @output(custom_name=param.Number()) Multiple outputs may be declared using keywords mapping from output name to the type for Python >= 3.6 or using tuples of the same format, which is supported for earlier versions, i.e. these two declarations are equivalent: @output(number=param.Number(), string=param.String()) @output((‘number’, param.Number()), (‘string’, param.String())) output also accepts Python object types which will be upgraded to a ClassSelector, e.g.: @output(int) class param.parameterized.overridable_property(fget=None, fset=None, fdel=None, doc=None)[source] Bases: object The same as Python’s “property” attribute, but allows the accessor methods to be overridden in subclasses. param.parameterized.pprint(val, imports, prefix='\n ', settings=[], unknown_value='<?>', qualify=False, separator='')[source] (Experimental) Pretty printed representation of a parameterized object that may be evaluated with eval. Similar to repr except introspection of the constructor (__init__) ensures a valid and succinct representation is generated. Only parameters are represented (whether specified as standard, positional, or keyword arguments). Parameters specified as positional arguments are always shown, followed by modified parameters specified as keyword arguments, sorted by precedence. unknown_value determines what to do where a representation cannot be generated for something required to recreate the object. Such things include non-parameter positional and keyword arguments, and certain values of parameters (e.g. some random state objects). Supplying an unknown_value of None causes unrepresentable things to be silently ignored. If unknown_value is a string, that string will appear in place of any unrepresentable things. If unknown_value is False, an Exception will be raised if an unrepresentable value is encountered. If supplied, imports should be a list, and it will be populated with the set of imports required for the object and all of its parameter values. If qualify is True, the class’s path will be included (e.g. “a.b.C()”), otherwise only the class will appear (“C()”). Parameters will be separated by a comma only by default, but the separator parameter allows an additional separator to be supplied (e.g. a newline could be supplied to have each Parameter appear on a separate line). NOTE: pprint will replace script_repr in a future version of param, but is not yet a complete replacement for script_repr. param.parameterized.print_all_param_defaults()[source] Print the default values for all imported Parameters. param.parameterized.script_repr(val, imports, prefix, settings)[source] Variant of repr() designed for generating a runnable script. Instances of types that require special handling can use the script_repr_reg dictionary. Using the type as a key, add a function that returns a suitable representation of instances of that type, and adds the required import statement. The repr of a parameter can be suppressed by returning None from the appropriate hook in script_repr_reg. param.parameterized.script_repr_reg = {<class 'list'>: <function container_script_repr>, <class 'tuple'>: <function container_script_repr>, <class 'function'>: <function function_script_repr>} see script_repr() class param.parameterized.shared_parameters[source] Bases: object Context manager to share parameter instances when creating multiple Parameterized objects of the same type. Parameter default values are instantiated once and cached to be reused when another Parameterized object of the same type is instantiated. Can be useful to easily modify large collections of Parameterized objects at once and can provide a significant speedup. ## serializer Module¶ digraph inheritance3764b26524 { bgcolor=transparent; fontsize=18; rankdir=LR; size="12.0, 12.0"; "param.serializer.JSONSerialization" [URL="#param.serializer.JSONSerialization",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Class responsible for specifying JSON serialization, deserialization"]; "param.serializer.Serialization" -> "param.serializer.JSONSerialization" [arrowsize=0.5,style="setlinewidth(0.5)"]; "param.serializer.Serialization" [URL="#param.serializer.Serialization",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class used to implement different types of serialization."]; "param.serializer.UnsafeserializableException" [URL="#param.serializer.UnsafeserializableException",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "param.serializer.UnserializableException" [URL="#param.serializer.UnserializableException",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; } Classes used to support string serialization of Parameters and Parameterized objects. param.serializer.JSONNullable(json_type)[source] Express a JSON schema type as nullable to easily support Parameters that allow_None class param.serializer.JSONSerialization[source] Class responsible for specifying JSON serialization, deserialization and JSON schemas for Parameters and Parameterized classes and objects. classmethod declare_numeric_bounds(schema, bounds, inclusive_bounds)[source] Given an applicable numeric schema, augment with bounds information classmethod deserialize_parameter_value(pobj, pname, value)[source] Deserialize a single parameter value. classmethod deserialize_parameters(pobj, serialization, subset=None)[source] Deserialize a serialized object representing one or more Parameters into a dictionary of parameter values. classmethod serialize_parameter_value(pobj, pname)[source] Serialize a single parameter value. classmethod serialize_parameters(pobj, subset=None)[source] Serialize the parameters on a Parameterized object into a single serialized object, e.g. a JSON string. class param.serializer.Serialization[source] Bases: object Base class used to implement different types of serialization. classmethod deserialize_parameter_value(pobj, pname, value)[source] Deserialize a single parameter value. classmethod deserialize_parameters(pobj, serialized, subset=None)[source] Deserialize a serialized object representing one or more Parameters into a dictionary of parameter values. classmethod serialize_parameter_value(pobj, pname)[source] Serialize a single parameter value. classmethod serialize_parameters(pobj, subset=None)[source] Serialize the parameters on a Parameterized object into a single serialized object, e.g. a JSON string. exception param.serializer.UnsafeserializableException[source] Bases: Exception with_traceback() Exception.with_traceback(tb) – set self.__traceback__ to tb and return self. exception param.serializer.UnserializableException[source] Bases: Exception with_traceback() Exception.with_traceback(tb) – set self.__traceback__ to tb and return self. ## version Module¶ digraph inheritance736165aff1 { bgcolor=transparent; fontsize=18; rankdir=LR; size="12.0, 12.0"; "param.version.OldDeprecatedVersion" [URL="#param.version.OldDeprecatedVersion",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A simple approach to Python package versioning that supports PyPI"]; "param.version.Version" [URL="#param.version.Version",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A simple approach to Python package versioning that supports PyPI"]; } Provide consistent and up-to-date __version__ strings for Python packages. See https://github.com/holoviz/autover for more information. class param.version.OldDeprecatedVersion(release=None, fpath=None, commit=None, reponame=None, dev=None, commit_count=0)[source] Bases: object A simple approach to Python package versioning that supports PyPI releases and additional information when working with version control. When obtaining a package from PyPI, the version returned is a string-formatted rendering of the supplied release tuple. For instance, release (1,0) tagged as v1.0 in the version control system will return 1.0 for str(__version__). Any number of items can be supplied in the release tuple, with either two or three numeric versioning levels typical. During development, a command like git describe will be used to compute the number of commits since the last version tag, the short commit hash, and whether the commit is dirty (has changes not yet committed). Version tags must start with a lowercase ‘v’ and have a period in them, e.g. v2.0, v0.9.8 or v0.1. Development versions are supported by setting the dev argument to an appropriate dev version number. The corresponding tag can be PEP440 compliant (using .devX) of the form v0.1.dev3, v1.9.0.dev2 etc but it doesn’t have to be as the dot may be omitted i.e v0.1dev3, v1.9.0dev2 etc. Also note that when version control system (VCS) information is used, the comparison operators take into account the number of commits since the last version tag. This approach is often useful in practice to decide which version is newer for a single developer, but will not necessarily be reliable when comparing against a different fork or branch in a distributed VCS. For git, if you want version control information available even in an exported archive (e.g. a .zip file from GitHub), you can set the following line in the .gitattributes file of your project: __init__.py export-subst  abbrev(dev_suffix='')[source] Abbreviated string representation, optionally declaring whether it is a development version. property commit A specification for this particular VCS version, e.g. a short git SHA property commit_count Return the number of commits since the last release property dirty True if there are uncommited changes, False otherwise fetch()[source] Returns a tuple of the major version together with the appropriate SHA and dirty bit (for development version only). property release Return the release tuple verify(string_version=None)[source] Check that the version information is consistent with the VCS before doing a release. If supplied with a string version, this is also checked against the current version. Should be called from setup.py with the declared package version before releasing to PyPI. class param.version.Version(**kw)[source] Bases: object A simple approach to Python package versioning that supports PyPI releases and additional information when working with version control. When obtaining a package from PyPI, the version returned is a string-formatted rendering of the supplied release tuple. For instance, release (1,0) tagged as v1.0 in the version control system will return 1.0 for str(__version__). Any number of items can be supplied in the release tuple, with either two or three numeric versioning levels typical. During development, a command like git describe will be used to compute the number of commits since the last version tag, the short commit hash, and whether the commit is dirty (has changes not yet committed). Version tags must start with a lowercase ‘v’ and have a period in them, e.g. v2.0, v0.9.8 or v0.1 and may include the PEP440 prerelease identifiers of ‘a’ (alpha) ‘b’ (beta) or ‘rc’ (release candidate) allowing tags such as v2.0.a3, v0.9.8.b3 or v0.1.rc5. Also note that when version control system (VCS) information is used, the number of commits since the last version tag is determined. This approach is often useful in practice to decide which version is newer for a single developer, but will not necessarily be reliable when comparing against a different fork or branch in a distributed VCS. For git, if you want version control information available even in an exported archive (e.g. a .zip file from GitHub), you can set the following line in the .gitattributes file of your project: __init__.py export-subst  Note that to support pip installation directly from GitHub via git archive, a .version file must be tracked by the repo to supply the release number (otherwise only the short SHA is available). The PEP440 format returned is [N!]N(.N)*[{a|b|rc}N][.postN+SHA] where everything before .postN is obtained from the tag, the N in .postN is the number of commits since the last tag and the SHA is obtained via git describe. This later portion is only shown if the commit count since the last tag is non zero. Instead of ‘.post’, an alternate valid prefix such as ‘.rev’, ‘_rev’, ‘_r’ or ‘.r’ may be supplied. abbrev()[source] Abbreviated string representation of just the release number. property commit A specification for this particular VCS version, e.g. a short git SHA property commit_count Return the number of commits since the last release property dirty True if there are uncommited changes, False otherwise fetch()[source] Returns a tuple of the major version together with the appropriate SHA and dirty bit (for development version only). classmethod get_setup_version(setup_path, reponame, describe=False, dirty='report', pkgname=None, archive_commit=None)[source] Helper for use in setup.py to get the version from the .version file (if available) or more up-to-date information from git describe (if available). Assumes the __init__.py will be found in the directory {reponame}/__init__.py relative to setup.py unless pkgname is explicitly specified in which case that name is used instead. If describe is True, the raw string obtained from git described is returned which is useful for updating the .version file. The dirty policy can be one of ‘report’, ‘strip’, ‘raise’. If it is ‘report’ the version string may end in ‘-dirty’ if the repository is in a dirty state. If the policy is ‘strip’, the ‘-dirty’ suffix will be stripped out if present. If the policy is ‘raise’, an exception is raised if the repository is in a dirty state. This can be useful if you want to make sure packages are not built from a dirty repository state. property prerelease Either None or one of ‘aN’ (alpha), ‘bN’ (beta) or ‘rcN’ (release candidate) where N is an integer. property release Return the release tuple verify(string_version=None)[source] Check that the version information is consistent with the VCS before doing a release. If supplied with a string version, this is also checked against the current version. Should be called from setup.py with the declared package version before releasing to PyPI. param.version.get_setup_version(location, reponame, pkgname=None, archive_commit=None)[source] Helper for use in setup.py to get the current version from either git describe or the .version file (if available). Set pkgname to the package name if it is different from the repository name. To ensure git information is included in a git archive, add setup.py to .gitattributes (in addition to __init__):  __init__.py export-subst setup.py export-subst  Then supply “$Format:%h$” for archive_commit. param.version.get_setupcfg_version()[source] As get_setup_version(), but configure via setup.cfg. If your project uses setup.cfg to configure setuptools, and hence has at least a “name” key in the [metadata] section, you can set the version as follows:  [metadata] name = mypackage version = attr: autover.version.get_setup_version2  If the repository name is different from the package name, specify reponame as a [tool:autover] option:  [tool:autover] reponame = mypackage  To ensure git information is included in a git archive, add setup.cfg to .gitattributes (in addition to __init__):  __init__.py export-subst setup.cfg export-subst  Then add the following to setup.cfg:  [tool:autover.configparser_workaround.archive_commit=$Format:%h\$] 

The above being a section heading rather than just a key is because setuptools requires % to be escaped with %, or it can’t parse setup.cfg…but then git export-subst would not work.