django_bird.manifest

Module Contents

Classes

PathPrefix

Path prefixes used for normalizing template paths.

Functions

normalize_path

Normalize a template path to remove system-specific information.

load_asset_manifest

Load asset manifest from the default location.

generate_asset_manifest

Generate a manifest by scanning templates for component usage.

save_asset_manifest

Save asset manifest to a file.

default_manifest_path

Get the default manifest path.

Data

API

django_bird.manifest.logger

‘getLogger(…)’

django_bird.manifest._manifest_cache

None

class django_bird.manifest.PathPrefix

Bases: str, enum.Enum

Path prefixes used for normalizing template paths.

Initialization

Initialize self. See help(type(self)) for accurate signature.

PKG

‘pkg’

APP

‘app’

EXT

‘ext’

prepend_to(path: str) str

Generate a prefixed path string by prepending this prefix to a path.

Args: path: The path to prefix

Returns: str: A string with this prefix and the path

classmethod has_prefix(path: str) bool

Check if a path already has one of the recognized prefixes.

Args: path: The path to check

Returns: bool: True if the path starts with any of the recognized prefixes

django_bird.manifest.normalize_path(path: str) str

Normalize a template path to remove system-specific information.

Args: path: The template path to normalize

Returns: str: A normalized path without system-specific details

django_bird.manifest.load_asset_manifest() dict[str, list[str]] | None

Load asset manifest from the default location.

Returns a simple dict mapping template paths to lists of component names. If the manifest cannot be loaded, returns None and falls back to runtime scanning.

Returns: dict[str, list[str]] | None: Manifest data or None if not found or invalid

django_bird.manifest.generate_asset_manifest() dict[str, list[str]]

Generate a manifest by scanning templates for component usage.

Returns: dict[str, list[str]]: A dictionary mapping template paths to lists of component names.

django_bird.manifest.save_asset_manifest(manifest_data: dict[str, list[str]], path: pathlib.Path | str) None

Save asset manifest to a file.

Args: manifest_data: The manifest data to save path: Path where to save the manifest

django_bird.manifest.default_manifest_path() pathlib.Path

Get the default manifest path.

Returns: Path: The default path for the asset manifest file