faust.types.settings.params
¶
- class faust.types.settings.params.Param(*, name: str, env_name: Optional[str] = None, default: Optional[IT] = None, default_alias: Optional[str] = None, default_template: Optional[str] = None, allow_none: Optional[bool] = None, ignore_default: Optional[bool] = None, section: Optional[_Section] = None, version_introduced: Optional[str] = None, version_deprecated: Optional[str] = None, version_removed: Optional[str] = None, version_changed: Optional[Mapping[str, str]] = None, deprecation_reason: Optional[str] = None, related_cli_options: Optional[Mapping[str, List[str]]] = None, related_settings: Optional[List[Any]] = None, help: Optional[str] = None, **kwargs: Any)[source]¶
Faust setting desscription.
Describes a Faust setting, how to read it from environment variables or from a configuration object.
- text_type: ClassVar[Tuple[Any, ...]] = (typing.Any,)¶
Textual description of setting type. This is used by
extra/tools/render_configuration_reference.py
to display the types supported by this setting.Can be a tuple of actual classes, or a tuple of strings. If a tuple of classes say a setting that accepts
str
andint
:text_type = (str, int)
the generated description will be:
:type: :class:`str` / :class:`int`
- deprecation_warning_template: str = 'Setting {self.name} is deprecated since Faust version {self.version_deprecated}: {self.deprecation_reason}. {alt_removal}'¶
Template used to generate a deprecation warning for deprecated settings.
- deprecation_removal_warning: str = 'Further the setting is scheduled to be removed in Faust version {self.version_removal}.'¶
Template used to generate an additional removal warning for the deprecation warning.
- storage_name: str¶
Storage name (e.g.
_broker_request_timeout
). This is the attribute name where we’ll be storing the actual value for the setting. For exampleSettings.broker_request_timeout
will be a property that callsParam.__get__
on attribute access, and.__set__
when setting attribute value, and those will use the underlyingSettings._broker_request_timeout
storage attribute to access/store the current value.
- env_name: Optional[str] = None¶
Environment variable name for setting. For
broker_request_timeout
this would beenv_name="BROKER_REQUEST_TIMEOUT"
- default: IT = None¶
Default value for setting.
Note that this will not be used if
default_alias
ordefaut_template
is set.
- default_alias: Optional[str] = None¶
If setting is not customized this is an optional list of other settings that we should take default value from. For example the
broker_consumer
/broker_producer
settings can configure the broker URL for consumers and producers separately but take their default value from the broker setting.
- default_template: Optional[str] = None¶
Default template. If set the default value will be generated from this format string template. For example the
canonical_url
setting uses ``default_template=’http://{conf.web_host}:{conf.web_port}’ to generate a default value from theweb_host
andweb_port
settings.
- section: _Section¶
The configuration section this setting belongs to. E.g.
sections.Common
.
- version_introduced: Optional[str] = None¶
The version that this setting was first introduced. This is used by
extra/tools/render_configuration_reference.py
to generate a version added directive:.. versionadded:: 1.10
- version_deprecated: Optional[str] = None¶
Set this if the setting is deprecated and should not be used anymore. Deprecated settings are not added to the configuration reference. Note: You must also set a
deprecation_reason
.
- version_removed: Optional[str] = None¶
Set this if the setting should be disabled completely, but still be included in the code. This is rare, no setting should be included in the code if it has been removed. Currently this is only used for the example setting that describes how you can add new settings.
- version_changed: Optional[Mapping[str, str]] = None¶
Mapping of version changes and reason for changing. This is used by
extra/tools/render_configuration_reference.py
For example if this was enabled by default but then changed to be disabled by default in version 1.30, then you can specify that asversion_changed={'1.30': 'Disabled by default.'}
and the configuration reference will be rendered with the following version changed directive added:.. versionchanged:: 1.30 Disabled by default.
Mapping of related command line options. This should be a mapping from command name to a list of option names.
For example the
canonical_url
setting lists related options as:related_cli_options={ 'faust worker': ['--web-host', '--web-port'], }
And this will end up in the configuration reference as:
:related-options: :option:`faust worker --web-host`, :option:`faust worker --web-port`
List of related settings. For example for the
canonical_url
setting the list of related settings are defined as:related_settings=[web_host, web_port]
. The configuration reference will then include that as::related-settings: :setting:`web_host`, :setting:`web_port`
- on_get_value(fun: Callable[[_Settings, OT], OT]) Callable[[_Settings, OT], OT] [source]¶
Decorator that adds a callback when this setting is retrieved.
- Return type:
_CallableGenericAlias
[_Settings
, ~OT, ~OT]
- on_set_default(fun: Callable[[_Settings], IT]) Callable[[_Settings], IT] [source]¶
Decorator that adds a callback when a default value is used.
- Return type:
_CallableGenericAlias
[_Settings
, ~IT]
- on_get(conf: _Settings) OT [source]¶
What happens when the setting is accessed/retrieved.
- Return type:
~OT
- prepare_get(conf: _Settings, value: OT) OT [source]¶
Prepare value when accessed/retrieved.
- Return type:
~OT
- on_set(settings: Any, value: OT) None [source]¶
What happens when the setting is stored/set.
- Return type:
None
- set_class_default(cls: Type) None [source]¶
Set class default value for storage attribute.
- Return type:
None
- on_init_set_value(conf: _Settings, provided_value: Optional[IT]) None [source]¶
What happens at
Settings.__init__
to store provided value.- Parameters:
conf (
_Settings
) – Settings object.provided_value (
_UnionGenericAlias
[~IT,None
]) – Provided configuration value passed toSettings.__init__
orNone
if not set.
- Return type:
None
- on_init_set_default(conf: _Settings, provided_value: Optional[IT]) None [source]¶
What happens at
Settings.__init__
to set default value.- Parameters:
conf (
_Settings
) – Settings object.provided_value (
_UnionGenericAlias
[~IT,None
]) – Provided configuration value passed toSettings.__init__
orNone
if not set.
- Return type:
None
- validate_before(value: Optional[IT] = None) None [source]¶
Validate value before setting is converted to the target type.
- Return type:
None
- validate_after(value: OT) None [source]¶
Validate value after it has been converted to its target type.
- Return type:
None
- prepare_init_default(conf: _Settings, value: IT) OT [source]¶
Prepare default value for storage.
- Return type:
~OT
- class faust.types.settings.params.Bool(*, name: str, env_name: Optional[str] = None, default: Optional[IT] = None, default_alias: Optional[str] = None, default_template: Optional[str] = None, allow_none: Optional[bool] = None, ignore_default: Optional[bool] = None, section: Optional[_Section] = None, version_introduced: Optional[str] = None, version_deprecated: Optional[str] = None, version_removed: Optional[str] = None, version_changed: Optional[Mapping[str, str]] = None, deprecation_reason: Optional[str] = None, related_cli_options: Optional[Mapping[str, List[str]]] = None, related_settings: Optional[List[Any]] = None, help: Optional[str] = None, **kwargs: Any)[source]¶
Boolean setting type.
- text_type: ClassVar[Tuple[Any, ...]] = (<class 'bool'>,)¶
Textual description of setting type. This is used by
extra/tools/render_configuration_reference.py
to display the types supported by this setting.Can be a tuple of actual classes, or a tuple of strings. If a tuple of classes say a setting that accepts
str
andint
:text_type = (str, int)
the generated description will be:
:type: :class:`str` / :class:`int`
- class faust.types.settings.params.Str(*, name: str, env_name: Optional[str] = None, default: Optional[IT] = None, default_alias: Optional[str] = None, default_template: Optional[str] = None, allow_none: Optional[bool] = None, ignore_default: Optional[bool] = None, section: Optional[_Section] = None, version_introduced: Optional[str] = None, version_deprecated: Optional[str] = None, version_removed: Optional[str] = None, version_changed: Optional[Mapping[str, str]] = None, deprecation_reason: Optional[str] = None, related_cli_options: Optional[Mapping[str, List[str]]] = None, related_settings: Optional[List[Any]] = None, help: Optional[str] = None, **kwargs: Any)[source]¶
String setting type.
- text_type: ClassVar[Tuple[Any, ...]] = (<class 'str'>,)¶
Textual description of setting type. This is used by
extra/tools/render_configuration_reference.py
to display the types supported by this setting.Can be a tuple of actual classes, or a tuple of strings. If a tuple of classes say a setting that accepts
str
andint
:text_type = (str, int)
the generated description will be:
:type: :class:`str` / :class:`int`
- class faust.types.settings.params.Severity(*, name: str, env_name: Optional[str] = None, default: Optional[IT] = None, default_alias: Optional[str] = None, default_template: Optional[str] = None, allow_none: Optional[bool] = None, ignore_default: Optional[bool] = None, section: Optional[_Section] = None, version_introduced: Optional[str] = None, version_deprecated: Optional[str] = None, version_removed: Optional[str] = None, version_changed: Optional[Mapping[str, str]] = None, deprecation_reason: Optional[str] = None, related_cli_options: Optional[Mapping[str, List[str]]] = None, related_settings: Optional[List[Any]] = None, help: Optional[str] = None, **kwargs: Any)[source]¶
Logging severity setting type.
- text_type: ClassVar[Tuple[Any, ...]] = (<class 'str'>, <class 'int'>)¶
Textual description of setting type. This is used by
extra/tools/render_configuration_reference.py
to display the types supported by this setting.Can be a tuple of actual classes, or a tuple of strings. If a tuple of classes say a setting that accepts
str
andint
:text_type = (str, int)
the generated description will be:
:type: :class:`str` / :class:`int`
- class faust.types.settings.params.Int(*, name: str, env_name: Optional[str] = None, default: Optional[IT] = None, default_alias: Optional[str] = None, default_template: Optional[str] = None, allow_none: Optional[bool] = None, ignore_default: Optional[bool] = None, section: Optional[_Section] = None, version_introduced: Optional[str] = None, version_deprecated: Optional[str] = None, version_removed: Optional[str] = None, version_changed: Optional[Mapping[str, str]] = None, deprecation_reason: Optional[str] = None, related_cli_options: Optional[Mapping[str, List[str]]] = None, related_settings: Optional[List[Any]] = None, help: Optional[str] = None, **kwargs: Any)[source]¶
Signed integer setting type.
- class faust.types.settings.params.UnsignedInt(*, name: str, env_name: Optional[str] = None, default: Optional[IT] = None, default_alias: Optional[str] = None, default_template: Optional[str] = None, allow_none: Optional[bool] = None, ignore_default: Optional[bool] = None, section: Optional[_Section] = None, version_introduced: Optional[str] = None, version_deprecated: Optional[str] = None, version_removed: Optional[str] = None, version_changed: Optional[Mapping[str, str]] = None, deprecation_reason: Optional[str] = None, related_cli_options: Optional[Mapping[str, List[str]]] = None, related_settings: Optional[List[Any]] = None, help: Optional[str] = None, **kwargs: Any)[source]¶
Unsigned integer setting type.
- class faust.types.settings.params.Version(*, name: str, env_name: Optional[str] = None, default: Optional[IT] = None, default_alias: Optional[str] = None, default_template: Optional[str] = None, allow_none: Optional[bool] = None, ignore_default: Optional[bool] = None, section: Optional[_Section] = None, version_introduced: Optional[str] = None, version_deprecated: Optional[str] = None, version_removed: Optional[str] = None, version_changed: Optional[Mapping[str, str]] = None, deprecation_reason: Optional[str] = None, related_cli_options: Optional[Mapping[str, List[str]]] = None, related_settings: Optional[List[Any]] = None, help: Optional[str] = None, **kwargs: Any)[source]¶
Version setting type.
Versions must be greater than
1
.
- class faust.types.settings.params.Port(*, name: str, env_name: Optional[str] = None, default: Optional[IT] = None, default_alias: Optional[str] = None, default_template: Optional[str] = None, allow_none: Optional[bool] = None, ignore_default: Optional[bool] = None, section: Optional[_Section] = None, version_introduced: Optional[str] = None, version_deprecated: Optional[str] = None, version_removed: Optional[str] = None, version_changed: Optional[Mapping[str, str]] = None, deprecation_reason: Optional[str] = None, related_cli_options: Optional[Mapping[str, List[str]]] = None, related_settings: Optional[List[Any]] = None, help: Optional[str] = None, **kwargs: Any)[source]¶
Network port setting type.
Ports must be in the range 1-65535.
- class faust.types.settings.params.Seconds(*, name: str, env_name: Optional[str] = None, default: Optional[IT] = None, default_alias: Optional[str] = None, default_template: Optional[str] = None, allow_none: Optional[bool] = None, ignore_default: Optional[bool] = None, section: Optional[_Section] = None, version_introduced: Optional[str] = None, version_deprecated: Optional[str] = None, version_removed: Optional[str] = None, version_changed: Optional[Mapping[str, str]] = None, deprecation_reason: Optional[str] = None, related_cli_options: Optional[Mapping[str, List[str]]] = None, related_settings: Optional[List[Any]] = None, help: Optional[str] = None, **kwargs: Any)[source]¶
Seconds setting type.
Converts from
float
/timedelta
tofloat
.- text_type: ClassVar[Tuple[Any, ...]] = (<class 'float'>, <class 'datetime.timedelta'>)¶
Textual description of setting type. This is used by
extra/tools/render_configuration_reference.py
to display the types supported by this setting.Can be a tuple of actual classes, or a tuple of strings. If a tuple of classes say a setting that accepts
str
andint
:text_type = (str, int)
the generated description will be:
:type: :class:`str` / :class:`int`
- class faust.types.settings.params.Credentials(*, name: str, env_name: Optional[str] = None, default: Optional[IT] = None, default_alias: Optional[str] = None, default_template: Optional[str] = None, allow_none: Optional[bool] = None, ignore_default: Optional[bool] = None, section: Optional[_Section] = None, version_introduced: Optional[str] = None, version_deprecated: Optional[str] = None, version_removed: Optional[str] = None, version_changed: Optional[Mapping[str, str]] = None, deprecation_reason: Optional[str] = None, related_cli_options: Optional[Mapping[str, List[str]]] = None, related_settings: Optional[List[Any]] = None, help: Optional[str] = None, **kwargs: Any)[source]¶
Authentication credentials setting type.
- text_type: ClassVar[Tuple[Any, ...]] = (<class 'faust.types.auth.CredentialsT'>,)¶
Textual description of setting type. This is used by
extra/tools/render_configuration_reference.py
to display the types supported by this setting.Can be a tuple of actual classes, or a tuple of strings. If a tuple of classes say a setting that accepts
str
andint
:text_type = (str, int)
the generated description will be:
:type: :class:`str` / :class:`int`
- to_python(conf: _Settings, value: Union[CredentialsT, SSLContext]) Optional[CredentialsT] [source]¶
Convert value in input type to its output type.
- Return type:
_UnionGenericAlias
[CredentialsT
,None
]
- class faust.types.settings.params.SSLContext(*, name: str, env_name: Optional[str] = None, default: Optional[IT] = None, default_alias: Optional[str] = None, default_template: Optional[str] = None, allow_none: Optional[bool] = None, ignore_default: Optional[bool] = None, section: Optional[_Section] = None, version_introduced: Optional[str] = None, version_deprecated: Optional[str] = None, version_removed: Optional[str] = None, version_changed: Optional[Mapping[str, str]] = None, deprecation_reason: Optional[str] = None, related_cli_options: Optional[Mapping[str, List[str]]] = None, related_settings: Optional[List[Any]] = None, help: Optional[str] = None, **kwargs: Any)[source]¶
SSL context setting type.
- text_type: ClassVar[Tuple[Any, ...]] = (<class 'ssl.SSLContext'>,)¶
Textual description of setting type. This is used by
extra/tools/render_configuration_reference.py
to display the types supported by this setting.Can be a tuple of actual classes, or a tuple of strings. If a tuple of classes say a setting that accepts
str
andint
:text_type = (str, int)
the generated description will be:
:type: :class:`str` / :class:`int`
- class faust.types.settings.params.Dict(*, name: str, env_name: Optional[str] = None, default: Optional[IT] = None, default_alias: Optional[str] = None, default_template: Optional[str] = None, allow_none: Optional[bool] = None, ignore_default: Optional[bool] = None, section: Optional[_Section] = None, version_introduced: Optional[str] = None, version_deprecated: Optional[str] = None, version_removed: Optional[str] = None, version_changed: Optional[Mapping[str, str]] = None, deprecation_reason: Optional[str] = None, related_cli_options: Optional[Mapping[str, List[str]]] = None, related_settings: Optional[List[Any]] = None, help: Optional[str] = None, **kwargs: Any)[source]¶
Dictionary setting type.
- text_type: ClassVar[Tuple[Any, ...]] = (<class 'dict'>,)¶
Textual description of setting type. This is used by
extra/tools/render_configuration_reference.py
to display the types supported by this setting.Can be a tuple of actual classes, or a tuple of strings. If a tuple of classes say a setting that accepts
str
andint
:text_type = (str, int)
the generated description will be:
:type: :class:`str` / :class:`int`
- class faust.types.settings.params.LogHandlers(*, name: str, env_name: Optional[str] = None, default: Optional[IT] = None, default_alias: Optional[str] = None, default_template: Optional[str] = None, allow_none: Optional[bool] = None, ignore_default: Optional[bool] = None, section: Optional[_Section] = None, version_introduced: Optional[str] = None, version_deprecated: Optional[str] = None, version_removed: Optional[str] = None, version_changed: Optional[Mapping[str, str]] = None, deprecation_reason: Optional[str] = None, related_cli_options: Optional[Mapping[str, List[str]]] = None, related_settings: Optional[List[Any]] = None, help: Optional[str] = None, **kwargs: Any)[source]¶
Log handler list setting type.
- text_type: ClassVar[Tuple[Any, ...]] = (typing.List[logging.Handler],)¶
Textual description of setting type. This is used by
extra/tools/render_configuration_reference.py
to display the types supported by this setting.Can be a tuple of actual classes, or a tuple of strings. If a tuple of classes say a setting that accepts
str
andint
:text_type = (str, int)
the generated description will be:
:type: :class:`str` / :class:`int`
- class faust.types.settings.params.Timezone(*, name: str, env_name: Optional[str] = None, default: Optional[IT] = None, default_alias: Optional[str] = None, default_template: Optional[str] = None, allow_none: Optional[bool] = None, ignore_default: Optional[bool] = None, section: Optional[_Section] = None, version_introduced: Optional[str] = None, version_deprecated: Optional[str] = None, version_removed: Optional[str] = None, version_changed: Optional[Mapping[str, str]] = None, deprecation_reason: Optional[str] = None, related_cli_options: Optional[Mapping[str, List[str]]] = None, related_settings: Optional[List[Any]] = None, help: Optional[str] = None, **kwargs: Any)[source]¶
Timezone setting type.
- text_type: ClassVar[Tuple[Any, ...]] = (<class 'datetime.tzinfo'>,)¶
Textual description of setting type. This is used by
extra/tools/render_configuration_reference.py
to display the types supported by this setting.Can be a tuple of actual classes, or a tuple of strings. If a tuple of classes say a setting that accepts
str
andint
:text_type = (str, int)
the generated description will be:
:type: :class:`str` / :class:`int`
- builtin_timezones = {'UTC': datetime.timezone.utc}¶
- class faust.types.settings.params.BrokerList(*, name: str, env_name: Optional[str] = None, default: Optional[IT] = None, default_alias: Optional[str] = None, default_template: Optional[str] = None, allow_none: Optional[bool] = None, ignore_default: Optional[bool] = None, section: Optional[_Section] = None, version_introduced: Optional[str] = None, version_deprecated: Optional[str] = None, version_removed: Optional[str] = None, version_changed: Optional[Mapping[str, str]] = None, deprecation_reason: Optional[str] = None, related_cli_options: Optional[Mapping[str, List[str]]] = None, related_settings: Optional[List[Any]] = None, help: Optional[str] = None, **kwargs: Any)[source]¶
Broker URL list setting type.
- text_type: ClassVar[Tuple[Any, ...]] = (<class 'str'>, <class 'yarl.URL'>, typing.List[str])¶
Textual description of setting type. This is used by
extra/tools/render_configuration_reference.py
to display the types supported by this setting.Can be a tuple of actual classes, or a tuple of strings. If a tuple of classes say a setting that accepts
str
andint
:text_type = (str, int)
the generated description will be:
:type: :class:`str` / :class:`int`
- default_scheme = 'kafka'¶
- class faust.types.settings.params.URL(*, name: str, env_name: Optional[str] = None, default: Optional[IT] = None, default_alias: Optional[str] = None, default_template: Optional[str] = None, allow_none: Optional[bool] = None, ignore_default: Optional[bool] = None, section: Optional[_Section] = None, version_introduced: Optional[str] = None, version_deprecated: Optional[str] = None, version_removed: Optional[str] = None, version_changed: Optional[Mapping[str, str]] = None, deprecation_reason: Optional[str] = None, related_cli_options: Optional[Mapping[str, List[str]]] = None, related_settings: Optional[List[Any]] = None, help: Optional[str] = None, **kwargs: Any)[source]¶
URL setting type.
- text_type: ClassVar[Tuple[Any, ...]] = (<class 'str'>, <class 'yarl.URL'>)¶
Textual description of setting type. This is used by
extra/tools/render_configuration_reference.py
to display the types supported by this setting.Can be a tuple of actual classes, or a tuple of strings. If a tuple of classes say a setting that accepts
str
andint
:text_type = (str, int)
the generated description will be:
:type: :class:`str` / :class:`int`
- class faust.types.settings.params.Path(*, name: str, env_name: Optional[str] = None, default: Optional[IT] = None, default_alias: Optional[str] = None, default_template: Optional[str] = None, allow_none: Optional[bool] = None, ignore_default: Optional[bool] = None, section: Optional[_Section] = None, version_introduced: Optional[str] = None, version_deprecated: Optional[str] = None, version_removed: Optional[str] = None, version_changed: Optional[Mapping[str, str]] = None, deprecation_reason: Optional[str] = None, related_cli_options: Optional[Mapping[str, List[str]]] = None, related_settings: Optional[List[Any]] = None, help: Optional[str] = None, **kwargs: Any)[source]¶
Path setting type.
- text_type: ClassVar[Tuple[Any, ...]] = (<class 'str'>, <class 'pathlib.Path'>)¶
Textual description of setting type. This is used by
extra/tools/render_configuration_reference.py
to display the types supported by this setting.Can be a tuple of actual classes, or a tuple of strings. If a tuple of classes say a setting that accepts
str
andint
:text_type = (str, int)
the generated description will be:
:type: :class:`str` / :class:`int`
- class faust.types.settings.params.Codec(*, name: str, env_name: Optional[str] = None, default: Optional[IT] = None, default_alias: Optional[str] = None, default_template: Optional[str] = None, allow_none: Optional[bool] = None, ignore_default: Optional[bool] = None, section: Optional[_Section] = None, version_introduced: Optional[str] = None, version_deprecated: Optional[str] = None, version_removed: Optional[str] = None, version_changed: Optional[Mapping[str, str]] = None, deprecation_reason: Optional[str] = None, related_cli_options: Optional[Mapping[str, List[str]]] = None, related_settings: Optional[List[Any]] = None, help: Optional[str] = None, **kwargs: Any)[source]¶
Serialization codec setting type.
- text_type: ClassVar[Tuple[Any, ...]] = (<class 'str'>, <class 'faust.types.codecs.CodecT'>)¶
Textual description of setting type. This is used by
extra/tools/render_configuration_reference.py
to display the types supported by this setting.Can be a tuple of actual classes, or a tuple of strings. If a tuple of classes say a setting that accepts
str
andint
:text_type = (str, int)
the generated description will be:
:type: :class:`str` / :class:`int`
- faust.types.settings.params.Enum(typ: T) Type[Param[Union[str, T], T]] [source]¶
Generate new enum setting type.
- Return type:
_GenericAlias
[_GenericAlias
[_UnionGenericAlias
[str
, ~T], ~T]]
- faust.types.settings.params.Symbol(typ: T) Type[Param[Union[str, T], T]] [source]¶
Generate new symbol setting type.
- Return type:
_GenericAlias
[_GenericAlias
[_UnionGenericAlias
[str
, ~T], ~T]]
- faust.types.settings.params.to_bool(term: Union[str, bool], *, table: Mapping[str, bool] = {'': False, '0': False, '1': True, 'false': False, 'no': False, 'off': False, 'on': True, 'true': True, 'yes': True}) bool [source]¶
Convert common terms for true/false to bool.
Examples (true/false/yes/no/on/off/1/0).
- Return type: