Skip to main content

CeleryOption

Customized option for Celery.

Attributes

AttributeTypeDescription
help_groupstring = nullThe category or group name used to organize this option within the help output.
default_value_from_contextstring = nullThe key used to look up a dynamic default value from the Click context object (ctx.obj) during execution.

Constructor

Signature

def CeleryOption(
*args: any,
**kwargs: any
)

Parameters

NameTypeDescription
*argsanyVariable length argument list.
**kwargsanyArbitrary keyword arguments, including 'help_group' and 'default_value_from_context'.

Signature

def CeleryOption(
*args: tuple,
**kwargs: dict
)

Parameters

NameTypeDescription
*argstuplePositional arguments passed to the base click.Option constructor.
**kwargsdictKeyword arguments including 'help_group' for UI categorization and 'default_value_from_context' for dynamic defaults.

Methods


get_default()

@classmethod
def get_default(
ctx: click.Context,
*args: tuple,
**kwargs: dict
) - > any

Retrieves the default value for the option, potentially resolving it from the application context if a context key is specified. This allows dynamic default values to be pulled from shared configuration stored in the Click context object.

Parameters

NameTypeDescription
ctxclick.ContextThe Click context object containing the application state and configuration.
*argstupleVariable length argument list passed to the parent class implementation.
**kwargsdictArbitrary keyword arguments passed to the parent class implementation.

Returns

TypeDescription
anyThe default value for the option, either sourced from the context object or the standard default attribute.