lightbulb.features

Feature flags that can be used to enable new or different Lightbulb behaviours.

Specify when creating your Client instance:

client = lightbulb.client_from_app(..., features=[...])

Added in version 3.2.0.

class Feature(name: 'str', *, requires_di_enabled: 'bool' = False)[source]
name: str

The name of the feature.

requires_di_enabled: bool

Whether the experiment requires DI to be globally enabled.

COMMAND_INJECT_CONTEXT = Feature(name='COMMAND_INJECT_CONTEXT', requires_di_enabled=True)

Use dependency injection for the Context parameter of command invoke methods. Could be useful if you want to provide your own subclass with extra features, without having to both specify the original parameter, and one for your own context type.

HOOK_INJECT_ALL_PARAMS = Feature(name='HOOK_DI_ALL_PARAMS', requires_di_enabled=True)

Use dependency injection for ALL execution hook parameters, allowing any (or both) of the previously-required ExecutionPipeline and Context parameters to be omitted. Potentially useful if you never use the ExecutionPipeline parameter and would like slightly cleaner function signatures.