Options

Introduction

Capsules can provide runtime configuration options that change the way the capsule operates. These options will appear on the client and can also be changed in the UI. Options have a type and constraints that define what values are valid.

class FloatOption(*, default: float, min_val: Optional[float], max_val: Optional[float], description: Optional[str] = None)

A capsule option that holds a floating point value with defined boundaries.

Parameters
  • default – The default value of this option

  • min_val – The minimum allowed value for this option, inclusive, or None for no lower limit

  • max_val – The maximum allowed value for this option, inclusive, or None for no upper limit

  • description – The description for this option

class IntOption(*, default: int, min_val: Optional[int], max_val: Optional[int], description: Optional[str] = None)

A capsule option that holds an integer value.

Parameters
  • default – The default value of this option

  • min_val – The minimum allowed value for this option, inclusive, or None for no lower limit

  • max_val – The maximum allowed value for this option, inclusive, or None for no upper limit

  • description – The description for this option

class EnumOption(*, default: str, choices: List[str], description: Optional[str] = None)

A capsule option that holds a choice from a discrete set of string values.

Parameters
  • default – The default value of this option

  • choices – A list of all valid values for this option

  • description – The description for this option

class BoolOption(*, default: bool, description: Optional[str] = None)

A capsule option that holds an boolean value.

Parameters
  • default – The default value of this option

  • description – The description for this option