Subpackages¶
Module contents¶
- class featuremanagement.FeatureFilter¶
Parent class for all feature filters.
- static alias(alias)¶
Decorator to set the alias for the filter.
- Parameters:
alias (str) – Alias for the filter.
- Returns:
Decorator.
- Return type:
callable
- abstract evaluate(context, **kwargs)¶
Determine if the feature flag is enabled for the given context.
- Parameters:
context (Mapping) – Context for the feature flag.
- property name¶
Get the name of the filter.
- Returns:
Name of the filter, or alias if it exists.
- Return type:
str
- class featuremanagement.FeatureManager(configuration, **kwargs)¶
Feature Manager that determines if a feature flag is enabled for the given context.
- Parameters:
configuration (Mapping) – Configuration object.
- Keyword Arguments:
feature_filters (list[FeatureFilter]) – Custom filters to be used for evaluating feature flags.
- is_enabled(feature_flag_id, user_id, **kwargs)¶
Determine if the feature flag is enabled for the given context.
- Parameters:
feature_flag_id (str) – Name of the feature flag.
- Returns:
True if the feature flag is enabled for the given context.
- Return type:
bool
- list_feature_flag_names()¶
List of all feature flag names.
- namedtuple featuremanagement.TargetingContext(user_id: str = '', groups: List[str] = [])¶
Represents the context for targeting a feature flag.
- Fields:
user_id (
str
) – The user ID. :type: strgroups (
List
[str
]) – The users groups. :type: List[str]
- class featuremanagement.TargetingFilter¶
Feature Filter that determines if the user is targeted for the feature flag.
- evaluate(context, **kwargs)¶
Determine if the feature flag is enabled for the given context.
- Keyword Arguments:
context (Mapping) – Context for evaluating the user/group.
- Returns:
True if the user is targeted for the feature flag.
- Return type:
bool
- class featuremanagement.TimeWindowFilter¶
Feature Filter that determines if the current time is within the time window.
- evaluate(context, **kwargs)¶
Determine if the feature flag is enabled for the given context.
- Keyword Arguments:
context (Mapping) – Mapping with the Start and End time for the feature flag.
- Returns:
True if the current time is within the time window.
- Return type:
bool