Module

config.merge

Deep merge utilities for config system.

Provides deterministic deep merging of configuration dictionaries with clear override semantics.

Functions

deep_merge
Deep merge override dict into base dict. Override semantics: - Dicts: recursively merge - Lists: r…
2 dict[str, Any]
def deep_merge(base: dict[str, Any], override: dict[str, Any]) -> dict[str, Any]

Deep merge override dict into base dict.

Override semantics:

  • Dicts: recursively merge
  • Lists: replace entirely (override wins)
  • Primitives: replace (override wins)

Parameters 2

Name Type Default Description
base dict[str, Any]

Base configuration dictionary

override dict[str, Any]

Override configuration dictionary

Returns

dict[str, Any]

Merged dictionary (new dict, does not mutate inputs)

set_nested_key
Set a nested key in config dictionary using dot notation. Creates intermediate dicts as needed.
3 None
def set_nested_key(config: dict[str, Any], key_path: str, value: Any) -> None

Set a nested key in config dictionary using dot notation.

Creates intermediate dicts as needed.

Parameters 3

Name Type Default Description
config dict[str, Any]

Configuration dictionary to modify (mutates in place)

key_path str

Dot-separated path (e.g., "site.theme.name")

value Any

Value to set

get_nested_key
Get a nested key from config dictionary using dot notation.
3 Any
def get_nested_key(config: dict[str, Any], key_path: str, default: Any = None) -> Any

Get a nested key from config dictionary using dot notation.

Parameters 3

Name Type Default Description
config dict[str, Any]

Configuration dictionary

key_path str

Dot-separated path (e.g., "site.theme.name")

default Any None

Default value if key not found

Returns

Any

Value at key_path, or default if not found