animedex.config.buildmeta

Optional build-metadata loader for animedex.

Loads animedex.config.build_info if it has been generated by tools/generate_build_info.py (or by make build_info) and exposes a single dictionary, BUILD_INFO, that the CLI banner and the self-diagnostic both consume.

When build_info.py is missing (the file is git-ignored, so this is the normal case in a fresh checkout) BUILD_INFO still exists but available is False. Every consumer should branch on BUILD_INFO["available"] rather than catching ImportError itself.

The fields, mirrored from the generator:

  • commit - full HEAD SHA, "unknown" if git was unavailable.

  • commit_short - 7-character HEAD SHA, "unknown" otherwise.

  • describe - git describe --tags --always --dirty output.

  • tag - tag at HEAD when HEAD is exactly on a tag; None otherwise.

  • dirty - bool; True if the working tree had uncommitted changes.

  • build_time - UTC ISO-8601 timestamp.

  • build_host - hostname captured at generation time.

  • available - True if the values came from the generated file, False if they are placeholders.

BUILD_INFO

animedex.config.buildmeta.BUILD_INFO: Dict[str, Any] = {'available': False, 'build_host': 'unknown', 'build_time': 'unknown', 'commit': 'unknown', 'commit_short': 'unknown', 'describe': 'unknown', 'dirty': False, 'tag': None}

Canonical build-metadata mapping. Always populated; check BUILD_INFO["available"] to distinguish a real build from a placeholder.

__all__

animedex.config.buildmeta.__all__ = ['BUILD_INFO', 'format_short', 'format_block', 'get_build_info', 'Optional']

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

format_short

animedex.config.buildmeta.format_short(prefix: str = '') str[source]

Return a short single-line description suitable for --version.

Examples:

  • "a2f7fa1 (clean) built 2026-05-07T03:35:00Z" when generated.

  • "build info not generated" when not.

Parameters:

prefix (str, optional) – Optional leading string included before the short form.

Returns:

A single line describing the build.

Return type:

str

format_block

animedex.config.buildmeta.format_block() str[source]

Return a multi-line block suitable for selftest output.

Returns:

Pre-formatted, indented diagnostic block. The trailing newline is not included.

Return type:

str

get_build_info

animedex.config.buildmeta.get_build_info() Dict[str, Any][source]

Return a copy of BUILD_INFO so callers cannot mutate it.

Returns:

A shallow copy of the canonical build-info dict.

Return type:

Dict[str, Any]