Module

assets.manifest

Persistent asset manifest for deterministic asset URL resolution.

The manifest maps logical asset paths (e.g.css/style.css) to the fingerprinted files actually written topublic/assetsalong with basic metadata that deployment tooling can inspect.

Classes

AssetManifestEntry dataclass
Immutable manifest entry for a single logical asset.
2

Immutable manifest entry for a single logical asset.

Attributes

Name Type Description
logical_path str

Logical path requested from templates (e.g.css/style.css).

output_path str

Relative path under the output directory (e.g.assets/css/style.X.css).

fingerprint str | None

Optional hash used when fingerprinting is enabled.

size_bytes int | None

File size for visibility / debugging.

updated_at str | None

ISO-8601 timestamp of the file write.

Methods 2

to_dict
Serialize entry to a JSON-friendly dict.
0 dict[str, str | int]
def to_dict(self) -> dict[str, str | int]

Serialize entry to a JSON-friendly dict.

Returns

dict[str, str | int]

from_dict classmethod
Create an entry from a JSON payload.
2 AssetManifestEntry
def from_dict(cls, logical_path: str, data: Mapping[str, object]) -> AssetManifestEntry

Create an entry from a JSON payload.

Parameters 2
logical_path str
data Mapping[str, object]
Returns

AssetManifestEntry

AssetManifest dataclass
Asset manifest container with serialization helpers. Example usage: manifest = AssetManifest()…
5

Asset manifest container with serialization helpers.

Example usage:

manifest = AssetManifest()
manifest.set_entry("css/style.css", "assets/css/style.ABC.css", fingerprint="ABC123")
manifest.write(path)

Attributes

Name Type Description
version int
generated_at str
_entries dict[str, AssetManifestEntry]

Methods 5

entries property
Read-only view of entries for inspection.
Mapping[str, AssetM…
def entries(self) -> Mapping[str, AssetManifestEntry]

Read-only view of entries for inspection.

Returns

Mapping[str, AssetManifestEntry]

set_entry
Add or replace a manifest entry for the logical asset.
2 None
def set_entry(self, logical_path: str, output_path: str) -> None

Add or replace a manifest entry for the logical asset.

Parameters 2
logical_path str
output_path str
get
Return the entry for the logical path, if present.
1 AssetManifestEntry | None
def get(self, logical_path: str) -> AssetManifestEntry | None

Return the entry for the logical path, if present.

Parameters 1
logical_path str
Returns

AssetManifestEntry | None

write
Serialize the manifest to disk using an atomic write.
1 None
def write(self, path: Path) -> None

Serialize the manifest to disk using an atomic write.

Parameters 1
path Path
load classmethod
Load a manifest from disk, returning None when missing or invalid.
1 AssetManifest | None
def load(cls, path: Path) -> AssetManifest | None

Load a manifest from disk, returning None when missing or invalid.

Parameters 1
path Path
Returns

AssetManifest | None

Functions

_isoformat
Convert a POSIX timestamp (seconds) to an ISO-8601 string.
1 str | None
def _isoformat(timestamp: float | None) -> str | None

Convert a POSIX timestamp (seconds) to an ISO-8601 string.

Parameters 1

Name Type Default Description
timestamp float | None

Returns

str | None

_posix
Normalize to POSIX-style paths for portability.
1 str
def _posix(path_like: str) -> str

Normalize to POSIX-style paths for portability.

Parameters 1

Name Type Default Description
path_like str

Returns

str