bikes.settings

Define settings for the application.

 1"""Define settings for the application."""
 2
 3# %% IMPORTS
 4
 5import pydantic as pdt
 6import pydantic_settings as pdts
 7
 8from bikes import jobs
 9
10# %% SETTINGS
11
12
13class Settings(pdts.BaseSettings, strict=True, frozen=True, extra="forbid"):
14    """Base class for application settings.
15
16    Use settings to provide high-level preferences.
17    i.e., to separate settings from provider (e.g., CLI).
18    """
19
20
21class MainSettings(Settings):
22    """Main settings of the application.
23
24    Parameters:
25        job (jobs.JobKind): job to run.
26    """
27
28    job: jobs.JobKind = pdt.Field(..., discriminator="KIND")
class Settings(pydantic_settings.main.BaseSettings):
14class Settings(pdts.BaseSettings, strict=True, frozen=True, extra="forbid"):
15    """Base class for application settings.
16
17    Use settings to provide high-level preferences.
18    i.e., to separate settings from provider (e.g., CLI).
19    """

Base class for application settings.

Use settings to provide high-level preferences. i.e., to separate settings from provider (e.g., CLI).

model_config: ClassVar[pydantic_settings.main.SettingsConfigDict] = {'extra': 'forbid', 'arbitrary_types_allowed': True, 'validate_default': True, 'case_sensitive': False, 'env_prefix': '', 'nested_model_default_partial_update': False, 'env_file': None, 'env_file_encoding': None, 'env_ignore_empty': False, 'env_nested_delimiter': None, 'env_parse_none_str': None, 'env_parse_enums': None, 'cli_prog_name': None, 'cli_parse_args': None, 'cli_parse_none_str': None, 'cli_hide_none_type': False, 'cli_avoid_json': False, 'cli_enforce_required': False, 'cli_use_class_docs_for_groups': False, 'cli_exit_on_error': True, 'cli_prefix': '', 'cli_flag_prefix_char': '-', 'cli_implicit_flags': False, 'cli_ignore_unknown_args': False, 'cli_kebab_case': False, 'json_file': None, 'json_file_encoding': None, 'yaml_file': None, 'yaml_file_encoding': None, 'toml_file': None, 'secrets_dir': None, 'protected_namespaces': ('model_validate', 'model_dump', 'settings_customise_sources'), 'enable_decoding': True, 'strict': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class MainSettings(Settings):
22class MainSettings(Settings):
23    """Main settings of the application.
24
25    Parameters:
26        job (jobs.JobKind): job to run.
27    """
28
29    job: jobs.JobKind = pdt.Field(..., discriminator="KIND")

Main settings of the application.

Arguments:
  • job (jobs.JobKind): job to run.
model_config: ClassVar[pydantic_settings.main.SettingsConfigDict] = {'extra': 'forbid', 'arbitrary_types_allowed': True, 'validate_default': True, 'case_sensitive': False, 'env_prefix': '', 'nested_model_default_partial_update': False, 'env_file': None, 'env_file_encoding': None, 'env_ignore_empty': False, 'env_nested_delimiter': None, 'env_parse_none_str': None, 'env_parse_enums': None, 'cli_prog_name': None, 'cli_parse_args': None, 'cli_parse_none_str': None, 'cli_hide_none_type': False, 'cli_avoid_json': False, 'cli_enforce_required': False, 'cli_use_class_docs_for_groups': False, 'cli_exit_on_error': True, 'cli_prefix': '', 'cli_flag_prefix_char': '-', 'cli_implicit_flags': False, 'cli_ignore_unknown_args': False, 'cli_kebab_case': False, 'json_file': None, 'json_file_encoding': None, 'yaml_file': None, 'yaml_file_encoding': None, 'toml_file': None, 'secrets_dir': None, 'protected_namespaces': ('model_validate', 'model_dump', 'settings_customise_sources'), 'enable_decoding': True, 'strict': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].