faust.types.settings.params

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

bool

class faust.types.settings.params.Param(*, name: str, env_name: str = None, default: IT = None, default_alias: str = None, default_template: str = None, allow_none: bool = None, ignore_default: bool = None, section: faust.types.settings.params._Section = None, version_introduced: str = None, version_deprecated: str = None, version_removed: str = None, version_changed: Mapping[str, str] = None, deprecation_reason: str = None, related_cli_options: Mapping[str, List[str]] = None, related_settings: List[Any] = None, help: str = None, **kwargs: Any) → None[source]

Faust setting desscription.

Describes a Faust setting, how to read it from environment variables or from a configuration object.

text_type = (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 and int:

text_type = (str, int)

the generated description will be:

:type: :class:`str` / :class:`int`
deprecation_warning_template = '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 = '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.

name = None

Setting name (e.g. broker_request_timeout).

storage_name = None

Storage name (e.g. _broker_request_timeout). This is the attribute name where we’ll be storing the actual value for the setting. For example Settings.broker_request_timeout will be a property that calls Param.__get__ on attribute access, and .__set__ when setting attribute value, and those will use the underlying Settings._broker_request_timeout storage attribute to access/store the current value.

env_name = None

Environment variable name for setting. For broker_request_timeout this would be env_name="BROKER_REQUEST_TIMEOUT"

default = None

Default value for setting.

Note that this will not be used if default_alias or defaut_template is set.

default_alias = 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 = None

Default template. If set the default value will be generated from this format string template. For exmaple the canonical_url setting uses ``default_template=’http://{conf.web_host}:{conf.web_port}’ to generate a default value from the web_host and web_port settings.

allow_none = False

Set to true if the value can be None.

ignore_default = False
section = None

The configuration section this setting belongs to. E.g. sections.Common.

version_introduced = 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 = 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 = 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 = 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 as version_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.
deprecation_reason = None
related_cli_options = None

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`
related_settings = None

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[[faust.types.settings.params._Settings, OT], OT]) → Callable[[faust.types.settings.params._Settings, OT], OT][source]

Decorator that adds a callback when this setting is retrieved.

Return type

Callable[[_Settings, ~OT], ~OT]

on_set_default(fun: Callable[faust.types.settings.params._Settings, IT]) → Callable[faust.types.settings.params._Settings, IT][source]

Decorator that adds a callback when a default value is used.

Return type

Callable[[_Settings], ~IT]

on_get(conf: faust.types.settings.params._Settings) → OT[source]

What happens when the setting is accessed/retrieved.

Return type

~OT

prepare_get(conf: faust.types.settings.params._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: faust.types.settings.params._Settings, provided_value: Optional[IT]) → None[source]

What happens at Settings.__init__ to store provided value.

Parameters
  • conf (_Settings) – Settings object.

  • provided_value (Optional[~IT]) – Provided configuration value passed to Settings.__init__ or None if not set.

Return type

None

on_init_set_default(conf: faust.types.settings.params._Settings, provided_value: Optional[IT]) → None[source]

What happens at Settings.__init__ to set default value.

Parameters
  • conf (_Settings) – Settings object.

  • provided_value (Optional[~IT]) – Provided configuration value passed to Settings.__init__ or None if not set.

Return type

None

build_deprecation_warning() → str[source]

Build deprecation warning for this setting.

Return type

str

validate_before(value: 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_set(conf: faust.types.settings.params._Settings, value: IT) → OT[source]

Prepare value for storage.

Return type

~OT

prepare_init_default(conf: faust.types.settings.params._Settings, value: IT) → OT[source]

Prepare default value for storage.

Return type

~OT

to_python(conf: faust.types.settings.params._Settings, value: IT) → OT[source]

Convert value in input type to its output type.

Return type

~OT

property active
Return type

bool

property deprecated
Return type

bool

property class_name
Return type

str

class faust.types.settings.params.Bool(*, name: str, env_name: str = None, default: IT = None, default_alias: str = None, default_template: str = None, allow_none: bool = None, ignore_default: bool = None, section: faust.types.settings.params._Section = None, version_introduced: str = None, version_deprecated: str = None, version_removed: str = None, version_changed: Mapping[str, str] = None, deprecation_reason: str = None, related_cli_options: Mapping[str, List[str]] = None, related_settings: List[Any] = None, help: str = None, **kwargs: Any) → None[source]

Boolean setting type.

text_type = (<class 'bool'>,)
to_python(conf: faust.types.settings.params._Settings, value: Any) → bool[source]

Convert given value to bool.

Return type

bool

class faust.types.settings.params.Str(*, name: str, env_name: str = None, default: IT = None, default_alias: str = None, default_template: str = None, allow_none: bool = None, ignore_default: bool = None, section: faust.types.settings.params._Section = None, version_introduced: str = None, version_deprecated: str = None, version_removed: str = None, version_changed: Mapping[str, str] = None, deprecation_reason: str = None, related_cli_options: Mapping[str, List[str]] = None, related_settings: List[Any] = None, help: str = None, **kwargs: Any) → None[source]

String setting type.

text_type = (<class 'str'>,)
class faust.types.settings.params.Severity(*, name: str, env_name: str = None, default: IT = None, default_alias: str = None, default_template: str = None, allow_none: bool = None, ignore_default: bool = None, section: faust.types.settings.params._Section = None, version_introduced: str = None, version_deprecated: str = None, version_removed: str = None, version_changed: Mapping[str, str] = None, deprecation_reason: str = None, related_cli_options: Mapping[str, List[str]] = None, related_settings: List[Any] = None, help: str = None, **kwargs: Any) → None[source]

Logging severity setting type.

text_type = (<class 'str'>, <class 'int'>)
class faust.types.settings.params.Int(*, name: str, env_name: str = None, default: IT = None, default_alias: str = None, default_template: str = None, allow_none: bool = None, ignore_default: bool = None, section: faust.types.settings.params._Section = None, version_introduced: str = None, version_deprecated: str = None, version_removed: str = None, version_changed: Mapping[str, str] = None, deprecation_reason: str = None, related_cli_options: Mapping[str, List[str]] = None, related_settings: List[Any] = None, help: str = None, **kwargs: Any) → None[source]

Signed integer setting type.

class faust.types.settings.params.UnsignedInt(*, name: str, env_name: str = None, default: IT = None, default_alias: str = None, default_template: str = None, allow_none: bool = None, ignore_default: bool = None, section: faust.types.settings.params._Section = None, version_introduced: str = None, version_deprecated: str = None, version_removed: str = None, version_changed: Mapping[str, str] = None, deprecation_reason: str = None, related_cli_options: Mapping[str, List[str]] = None, related_settings: List[Any] = None, help: str = None, **kwargs: Any) → None[source]

Unsigned integer setting type.

min_value = 0
class faust.types.settings.params.Version(*, name: str, env_name: str = None, default: IT = None, default_alias: str = None, default_template: str = None, allow_none: bool = None, ignore_default: bool = None, section: faust.types.settings.params._Section = None, version_introduced: str = None, version_deprecated: str = None, version_removed: str = None, version_changed: Mapping[str, str] = None, deprecation_reason: str = None, related_cli_options: Mapping[str, List[str]] = None, related_settings: List[Any] = None, help: str = None, **kwargs: Any) → None[source]

Version setting type.

Versions must be greater than 1.

min_value = 1
class faust.types.settings.params.Port(*, name: str, env_name: str = None, default: IT = None, default_alias: str = None, default_template: str = None, allow_none: bool = None, ignore_default: bool = None, section: faust.types.settings.params._Section = None, version_introduced: str = None, version_deprecated: str = None, version_removed: str = None, version_changed: Mapping[str, str] = None, deprecation_reason: str = None, related_cli_options: Mapping[str, List[str]] = None, related_settings: List[Any] = None, help: str = None, **kwargs: Any) → None[source]

Network port setting type.

Ports must be in the range 1-65535.

min_value = 1
max_value = 65535
class faust.types.settings.params.Seconds(*, name: str, env_name: str = None, default: IT = None, default_alias: str = None, default_template: str = None, allow_none: bool = None, ignore_default: bool = None, section: faust.types.settings.params._Section = None, version_introduced: str = None, version_deprecated: str = None, version_removed: str = None, version_changed: Mapping[str, str] = None, deprecation_reason: str = None, related_cli_options: Mapping[str, List[str]] = None, related_settings: List[Any] = None, help: str = None, **kwargs: Any) → None[source]

Seconds setting type.

Converts from float/timedelta to float.

text_type = (<class 'float'>, <class 'datetime.timedelta'>)
to_python(conf: faust.types.settings.params._Settings, value: Union[datetime.timedelta, float, str]) → float[source]

Convert value in input type to its output type.

Return type

float

class faust.types.settings.params.Credentials(*, name: str, env_name: str = None, default: IT = None, default_alias: str = None, default_template: str = None, allow_none: bool = None, ignore_default: bool = None, section: faust.types.settings.params._Section = None, version_introduced: str = None, version_deprecated: str = None, version_removed: str = None, version_changed: Mapping[str, str] = None, deprecation_reason: str = None, related_cli_options: Mapping[str, List[str]] = None, related_settings: List[Any] = None, help: str = None, **kwargs: Any) → None[source]

Authentication credentials setting type.

text_type = (<class 'faust.types.auth.CredentialsT'>,)
to_python(conf: faust.types.settings.params._Settings, value: Union[faust.types.auth.CredentialsT, ssl.SSLContext]) → Optional[faust.types.auth.CredentialsT][source]

Convert value in input type to its output type.

Return type

Optional[CredentialsT]

class faust.types.settings.params.SSLContext(*, name: str, env_name: str = None, default: IT = None, default_alias: str = None, default_template: str = None, allow_none: bool = None, ignore_default: bool = None, section: faust.types.settings.params._Section = None, version_introduced: str = None, version_deprecated: str = None, version_removed: str = None, version_changed: Mapping[str, str] = None, deprecation_reason: str = None, related_cli_options: Mapping[str, List[str]] = None, related_settings: List[Any] = None, help: str = None, **kwargs: Any) → None[source]

SSL context setting type.

text_type = (<class 'ssl.SSLContext'>,)
class faust.types.settings.params.Dict(*, name: str, env_name: str = None, default: IT = None, default_alias: str = None, default_template: str = None, allow_none: bool = None, ignore_default: bool = None, section: faust.types.settings.params._Section = None, version_introduced: str = None, version_deprecated: str = None, version_removed: str = None, version_changed: Mapping[str, str] = None, deprecation_reason: str = None, related_cli_options: Mapping[str, List[str]] = None, related_settings: List[Any] = None, help: str = None, **kwargs: Any) → None[source]

Dictionary setting type.

text_type = (<class 'dict'>,)
to_python(conf: faust.types.settings.params._Settings, value: Union[str, Mapping[str, T]]) → Mapping[str, T][source]

Convert value in input type to its output type.

Return type

Mapping[str, ~T]

class faust.types.settings.params.LogHandlers(*, name: str, env_name: str = None, default: IT = None, default_alias: str = None, default_template: str = None, allow_none: bool = None, ignore_default: bool = None, section: faust.types.settings.params._Section = None, version_introduced: str = None, version_deprecated: str = None, version_removed: str = None, version_changed: Mapping[str, str] = None, deprecation_reason: str = None, related_cli_options: Mapping[str, List[str]] = None, related_settings: List[Any] = None, help: str = None, **kwargs: Any) → None[source]

Log handler list setting type.

text_type = (typing.List[logging.Handler],)
prepare_init_default(conf: faust.types.settings.params._Settings, value: Any) → List[logging.Handler][source]

Prepare default value for storage.

Return type

List[Handler]

class faust.types.settings.params.Timezone(*, name: str, env_name: str = None, default: IT = None, default_alias: str = None, default_template: str = None, allow_none: bool = None, ignore_default: bool = None, section: faust.types.settings.params._Section = None, version_introduced: str = None, version_deprecated: str = None, version_removed: str = None, version_changed: Mapping[str, str] = None, deprecation_reason: str = None, related_cli_options: Mapping[str, List[str]] = None, related_settings: List[Any] = None, help: str = None, **kwargs: Any) → None[source]

Timezone setting type.

text_type = (<class 'datetime.tzinfo'>,)
builtin_timezones = {'UTC': datetime.timezone.utc}
to_python(conf: faust.types.settings.params._Settings, value: Union[str, datetime.tzinfo]) → datetime.tzinfo[source]

Convert value in input type to its output type.

Return type

tzinfo

class faust.types.settings.params.BrokerList(*, name: str, env_name: str = None, default: IT = None, default_alias: str = None, default_template: str = None, allow_none: bool = None, ignore_default: bool = None, section: faust.types.settings.params._Section = None, version_introduced: str = None, version_deprecated: str = None, version_removed: str = None, version_changed: Mapping[str, str] = None, deprecation_reason: str = None, related_cli_options: Mapping[str, List[str]] = None, related_settings: List[Any] = None, help: str = None, **kwargs: Any) → None[source]

Broker URL list setting type.

text_type = (<class 'str'>, <class 'yarl.URL'>, typing.List[str])
default_scheme = 'kafka'
to_python(conf: faust.types.settings.params._Settings, value: Union[str, yarl.URL, List[yarl.URL], List[str]]) → List[yarl.URL][source]

Convert value in input type to its output type.

Return type

List[URL]

broker_list(value: Union[str, yarl.URL, List[yarl.URL], List[str]]) → List[yarl.URL][source]
Return type

List[URL]

class faust.types.settings.params.URL(*, name: str, env_name: str = None, default: IT = None, default_alias: str = None, default_template: str = None, allow_none: bool = None, ignore_default: bool = None, section: faust.types.settings.params._Section = None, version_introduced: str = None, version_deprecated: str = None, version_removed: str = None, version_changed: Mapping[str, str] = None, deprecation_reason: str = None, related_cli_options: Mapping[str, List[str]] = None, related_settings: List[Any] = None, help: str = None, **kwargs: Any) → None[source]

URL setting type.

text_type = (<class 'str'>, <class 'yarl.URL'>)
to_python(conf: faust.types.settings.params._Settings, value: Union[str, yarl.URL]) → yarl.URL[source]

Convert value in input type to its output type.

Return type

URL

class faust.types.settings.params.Path(*, name: str, env_name: str = None, default: IT = None, default_alias: str = None, default_template: str = None, allow_none: bool = None, ignore_default: bool = None, section: faust.types.settings.params._Section = None, version_introduced: str = None, version_deprecated: str = None, version_removed: str = None, version_changed: Mapping[str, str] = None, deprecation_reason: str = None, related_cli_options: Mapping[str, List[str]] = None, related_settings: List[Any] = None, help: str = None, **kwargs: Any) → None[source]

Path setting type.

text_type = (<class 'str'>, <class 'pathlib.Path'>)
expanduser = True
to_python(conf: faust.types.settings.params._Settings, value: Union[str, pathlib.Path]) → pathlib.Path[source]

Convert value in input type to its output type.

Return type

Path

prepare_path(conf: faust.types.settings.params._Settings, path: pathlib.Path) → pathlib.Path[source]
Return type

Path

class faust.types.settings.params.Codec(*, name: str, env_name: str = None, default: IT = None, default_alias: str = None, default_template: str = None, allow_none: bool = None, ignore_default: bool = None, section: faust.types.settings.params._Section = None, version_introduced: str = None, version_deprecated: str = None, version_removed: str = None, version_changed: Mapping[str, str] = None, deprecation_reason: str = None, related_cli_options: Mapping[str, List[str]] = None, related_settings: List[Any] = None, help: str = None, **kwargs: Any) → None[source]

Serialization codec setting type.

text_type = (<class 'str'>, <class 'faust.types.codecs.CodecT'>)
faust.types.settings.params.Enum(typ: T) → Type[faust.types.settings.params.Param[Union[str, T], T]][source]

Generate new enum setting type.

Return type

Type[Param[~T]]

faust.types.settings.params.Symbol(typ: T) → Type[faust.types.settings.params.Param[Union[str, T], T]][source]

Generate new symbol setting type.

Return type

Type[Param[~T]]