Config Module

Source: gitlab_overviewer.config.__init__.py

Configuration management for gitlab_overviewer.

Implements Specification: Configuration Settings Layer §1-4, covering:

  • Settings sources and precedence (§1)

  • Supported settings keys (§2)

  • Parsing rules (§3)

  • Runtime behavior (§4)

Provides Pydantic-based Settings for CLI and environment configuration.

  • Settings – Main configuration class

See also: gitlab_overviewer.config.settings

gitlab_overviewer.config.settings

Source: gitlab_overviewer.config.settings.py

Settings layer implementation.

Implements Specification: Configuration Settings Layer §1-4, covering:

  • Sources & precedence (§1)

  • Supported settings keys (§2)

  • Parsing rules (§3)

  • Runtime behavior (§4)

class gitlab_overviewer.config.settings.CustomEnvSettingsSource(settings_cls, case_sensitive=None, env_prefix=None, env_nested_delimiter=None, env_nested_max_split=None, env_ignore_empty=None, env_parse_none_str=None, env_parse_enums=None)[source]

Bases: EnvSettingsSource

prepare_field_value(field_name, field, value, value_is_complex)[source]

Prepare value for the field.

  • Extract value for nested field.

  • Deserialize value to python object for complex field.

Parameters:
  • field – The field.

  • field_name – The field name.

Returns:

A tuple contains prepared value for the field.

Raises:

ValuesError – When There is an error in deserializing value for complex field.

class gitlab_overviewer.config.settings.Settings(*, GITLAB_HOST: str, GROUP_API_KEY: List[str], DEBUG: bool = False, DISPLAY_SHARED: bool = False, TODO_KEYWORDS: List[str] = ['status', 'todo', 'stand', 'fortschritt', 'offen', 'geplant'], API_RETRY_COUNT: int = 3, API_RETRY_BACKOFF: float = 1.0, TABLE_CONFIG: str = 'table_config.yaml', LOG_LEVEL: str = 'INFO')[source]

Bases: BaseSettings

Central application settings.

Priority order – highest first: 1. Manual overrides via override() (used from CLI flags) 2. Environment variables 3. Defaults defined here

Environment variable names mirror the legacy ones so existing setups keep working.

gitlab_host: str
group_api_key: List[str]
debug: bool
display_shared: bool
todo_keywords: List[str]
api_retry_count: int
api_retry_backoff: float
table_config: str
log_level: str
model_config: ClassVar[SettingsConfigDict] = {'arbitrary_types_allowed': True, 'case_sensitive': False, 'cli_avoid_json': False, 'cli_enforce_required': False, 'cli_exit_on_error': True, 'cli_flag_prefix_char': '-', 'cli_hide_none_type': False, 'cli_ignore_unknown_args': False, 'cli_implicit_flags': False, 'cli_kebab_case': False, 'cli_parse_args': None, 'cli_parse_none_str': None, 'cli_prefix': '', 'cli_prog_name': None, 'cli_shortcuts': None, 'cli_use_class_docs_for_groups': False, 'enable_decoding': True, 'env_file': '.env', 'env_file_encoding': None, 'env_ignore_empty': False, 'env_nested_delimiter': '__', 'env_nested_max_split': None, 'env_parse_enums': None, 'env_parse_none_str': None, 'env_prefix': '', 'extra': 'ignore', 'json_file': None, 'json_file_encoding': None, 'nested_model_default_partial_update': False, 'populate_by_name': True, 'protected_namespaces': ('model_validate', 'model_dump', 'settings_customise_sources'), 'secrets_dir': None, 'toml_file': None, 'validate_by_alias': True, 'validate_by_name': True, 'validate_default': True, 'yaml_config_section': None, 'yaml_file': None, 'yaml_file_encoding': None}

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

classmethod settings_customise_sources(settings_cls, init_settings, env_settings, dotenv_settings, file_secret_settings)[source]

Define the sources and their order for loading the settings values.

Parameters:
  • settings_cls – The Settings class.

  • init_settings – The InitSettingsSource instance.

  • env_settings – The EnvSettingsSource instance.

  • dotenv_settings – The DotEnvSettingsSource instance.

  • file_secret_settings – The SecretsSettingsSource instance.

Returns:

A tuple containing the sources and their order for loading the settings values.

validate_required_fields()[source]

Validate that required fields are provided.

classmethod _validate_gitlab_host(v)[source]

Validate gitlab_host is provided and is a valid URL.

classmethod _validate_group_api_key(v)[source]

Validate group_api_key is provided and is a list of strings.

classmethod _parse_boolean(v)[source]

Parse boolean values from various formats.

classmethod _parse_retry_count(v)[source]

Parse and validate retry count.

classmethod _parse_retry_backoff(v)[source]

Parse and validate retry backoff.

classmethod _validate_table_config_path(v)[source]

Validate table_config points to a readable file.

classmethod current()[source]

Return a cached singleton Settings instance.

A new instance is only created when no instance has been created yet (first call)

Return type:

Settings

classmethod set_singleton(instance)[source]
override(ignore_env=False, **kwargs)[source]

Return a new Settings instance with kwargs overriding fields. If ignore_env is True, do not load from environment or .env, only use current values and overrides.

classmethod from_args(args, ignore_env=False)[source]

Create settings instance overriding values contained in args.

Only attributes that are not None in args are considered – this mimics the behaviour of CLI flags having highest priority.

Environment variables are temporarily unset when CLI values override them to ensure proper precedence.

Parameters:
  • args – Namespace object with CLI arguments

  • ignore_env – If True, ignore environment variables and .env file

Return type:

Settings

__init__(**values)[source]

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.