Module

config.deprecation

Configuration deprecation handling.

Provides warnings for deprecated config keys with migration guidance. Follows the principle of graceful degradation - deprecated keys still work, but users are informed of the preferred alternatives.

Functions

check_deprecated_keys
Check for deprecated config keys and optionally warn.
3 list[tuple[str, str…
def check_deprecated_keys(config: dict[str, Any], source: str = 'configuration', warn: bool = True) -> list[tuple[str, str, str]]

Check for deprecated config keys and optionally warn.

Parameters 3

Name Type Default Description
config dict[str, Any]

Configuration dictionary to check

source str 'configuration'

Source description for log messages (e.g., "bengal.toml")

warn bool True

Whether to emit warnings (default: True)

Returns

list[tuple[str, str, str]]

List of (old_key, new_location, migration_note) tuples for deprecated keys found

print_deprecation_warnings
Print user-friendly deprecation warnings.
2 None
def print_deprecation_warnings(deprecated: list[tuple[str, str, str]], source: str = 'configuration') -> None

Print user-friendly deprecation warnings.

Parameters 2

Name Type Default Description
deprecated list[tuple[str, str, str]]

List of (old_key, new_location, note) from check_deprecated_keys()

source str 'configuration'

Source description for context Example output: ⚠️ Deprecated config keys in bengal.toml: • minify_assets → assets.minify Use 'assets.minify: true' instead of 'minify_assets: true' • generate_sitemap → features.sitemap Use 'features.sitemap: true' instead of 'generate_sitemap: true' These keys still work but will be removed in a future version.

migrate_deprecated_keys
Migrate deprecated keys to their new locations. This function moves values from deprecated flat ke…
2 dict[str, Any]
def migrate_deprecated_keys(config: dict[str, Any], in_place: bool = False) -> dict[str, Any]

Migrate deprecated keys to their new locations.

This function moves values from deprecated flat keys to their new nested locations. The original keys are preserved for backward compatibility unless in_place=True.

Parameters 2

Name Type Default Description
config dict[str, Any]

Configuration dictionary

in_place bool False

If True, remove old keys after migration

Returns

dict[str, Any]

Updated configuration dictionary

get_deprecation_summary
Get a summary of all deprecated keys for documentation.
0 str
def get_deprecation_summary() -> str

Get a summary of all deprecated keys for documentation.

Returns

str

Markdown-formatted summary of deprecated keys