Skip to main content

Option

Describes a Celery configuration option.

Attributes

AttributeTypeDescription
altstring = nullAlternative configuration setting name that can be used to provide the same value.
deprecate_bystring = nullThe version of Celery in which this configuration option was first marked as deprecated.
remove_bystring = nullThe version of Celery in which this configuration option is scheduled to be completely removed.
oldset = set()A set of legacy configuration names that previously referred to this option.
typemapdict = {"string": str, "int": int, "float": float, "any": lambda v: v, "bool": strtobool, "dict": dict, "tuple": tuple}A mapping of type names to callable conversion functions used to cast configuration values to their Python equivalents.

Constructor

Signature

def Option(
default: any = None,
*args: tuple,
**kwargs: dict
) - > null

Parameters

NameTypeDescription
defaultany = NoneThe default value for the configuration option.
*argstupleVariable length argument list.
**kwargsdictArbitrary keyword arguments used to set instance attributes, including 'type'.

Methods


to_python()

@classmethod
def to_python(
value: any
) - > any

Converts a raw configuration value into its corresponding Python object type based on the option's defined type mapping.

Parameters

NameTypeDescription
valueanyThe raw input value to be converted into a Python-native type.

Returns

TypeDescription
anyThe value cast to the appropriate Python type (e.g., int, bool, or dict) defined for this option.