archivebox.config.configset

Pydantic-backed config loading for ArchiveBox.

Module Contents

Classes

CaseConfigParser

IniConfigSettingsSource

Custom settings source that reads from ArchiveBox.conf (INI format). Flattens all sections into a single namespace.

BaseConfigSet

Base class for config sections.

Functions

_read_ini_config_cached

Data

COMPUTED_CONFIG_KEYS

_INI_CACHE

API

archivebox.config.configset.COMPUTED_CONFIG_KEYS[source]

(‘TERM_WIDTH’, ‘COMMIT_HASH’, ‘BUILD_TIME’, ‘USES_SUBDOMAIN_ROUTING’, ‘ENABLES_FULL_JS_REPLAY’, ‘CON…

class archivebox.config.configset.CaseConfigParser(defaults=None, dict_type=_default_dict, allow_no_value=False, *, delimiters=('=', ':'), comment_prefixes=('#', ';'), inline_comment_prefixes=None, strict=True, empty_lines_in_values=True, default_section=DEFAULTSECT, interpolation=_UNSET, converters=_UNSET)[source]

Bases: configparser.ConfigParser

optionxform(optionstr: str) str[source]
archivebox.config.configset._INI_CACHE: dict[tuple[str, float], dict[str, Any]][source]

None

archivebox.config.configset._read_ini_config_cached(config_path_str: str) dict[str, Any][source]
class archivebox.config.configset.IniConfigSettingsSource[source]

Bases: pydantic_settings.PydanticBaseSettingsSource

Custom settings source that reads from ArchiveBox.conf (INI format). Flattens all sections into a single namespace.

get_field_value(field: Any, field_name: str) tuple[Any, str, bool][source]
__call__() dict[str, Any][source]
_load_config_file() dict[str, Any][source]
class archivebox.config.configset.BaseConfigSet[source]

Bases: pydantic_settings.BaseSettings

Base class for config sections.

Automatically loads values from (highest to lowest priority):

  1. Environment variables

  2. ArchiveBox.conf file (INI format, flattened)

  3. Default values

Subclasses define fields with defaults and types:

class ShellConfig(BaseConfigSet):
    DEBUG: bool = Field(default=False)
    USE_COLOR: bool = Field(default=True)
model_config[source]

‘SettingsConfigDict(…)’

computed_config_keys: ClassVar[tuple[str, ...]][source]

()

classmethod settings_customise_sources(settings_cls: type[pydantic_settings.BaseSettings], init_settings: pydantic_settings.PydanticBaseSettingsSource, env_settings: pydantic_settings.PydanticBaseSettingsSource, dotenv_settings: pydantic_settings.PydanticBaseSettingsSource, file_secret_settings: pydantic_settings.PydanticBaseSettingsSource) tuple[pydantic_settings.PydanticBaseSettingsSource, ...][source]

Define the order of settings sources (first = highest priority).

classmethod load_from_file(config_path: pathlib.Path) dict[str, str][source]

Load config values from INI file.

__getitem__(key: str) Any[source]
__setitem__(key: str, value: Any) None[source]
update(*args, **kwargs) None[source]
__contains__(key: str) bool[source]
get(key: str, default: Any = None) Any[source]
as_dict() dict[str, Any][source]
items()[source]
keys()[source]
values()[source]