Option
Describes a Celery configuration option.
Attributes
| Attribute | Type | Description |
|---|---|---|
| alt | string = null | Alternative configuration setting name that can be used to provide the same value. |
| deprecate_by | string = null | The version of Celery in which this configuration option was first marked as deprecated. |
| remove_by | string = null | The version of Celery in which this configuration option is scheduled to be completely removed. |
| old | set = set() | A set of legacy configuration names that previously referred to this option. |
| typemap | dict = {"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
| Name | Type | Description |
|---|---|---|
| default | any = None | The default value for the configuration option. |
| *args | tuple | Variable length argument list. |
| **kwargs | dict | Arbitrary 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
| Name | Type | Description |
|---|---|---|
| value | any | The raw input value to be converted into a Python-native type. |
Returns
| Type | Description |
|---|---|
any | The value cast to the appropriate Python type (e.g., int, bool, or dict) defined for this option. |