config.schema

schema

Configuration schema definitions and version registry for keecas.

Manages schema versions, deprecated keys, renamed keys, and migration functions to handle breaking configuration changes across package versions.

Classes

Name Description
ConfigSchema Schema definition for a specific config version.

ConfigSchema

ConfigSchema(
    version,
    created_at,
    deprecated_keys,
    renamed_keys,
    removed_keys,
    migration_fn,
)

Schema definition for a specific config version.

Functions

Name Description
migrate_0_1_to_1_0 Migrate config from 0.1.x to 1.0.0
get_current_schema_version Get the current/latest schema version.
get_schema Get schema definition for a specific version.

migrate_0_1_to_1_0

migrate_0_1_to_1_0(old_config)

Migrate config from 0.1.x to 1.0.0

IMPORTANT: All user-customized values MUST be preserved during migration. Only transform structure/location, never lose user data.

Parameters

Name Type Description Default
old_config dict Configuration dict from v0.1.x required

Returns

Name Type Description
dict Migrated configuration dict for v1.0.0

get_current_schema_version

get_current_schema_version()

Get the current/latest schema version.

Returns

Name Type Description
str Latest schema version string

get_schema

get_schema(version_str)

Get schema definition for a specific version.

Parameters

Name Type Description Default
version_str str Schema version string required

Returns

Name Type Description
ConfigSchema | None ConfigSchema if found, None otherwise