Classes
AssetManifestEntry
dataclass
Immutable manifest entry for a single logical asset.
AssetManifestEntry
dataclass Immutable manifest entry for a single logical asset.
Attributes
| Name | Type | Description |
|---|---|---|
logical_path |
str |
Logical path requested from templates (e.g. |
output_path |
str |
Relative path under the output directory (e.g. |
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.
to_dict
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.
from_dict
classmethod 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()…
AssetManifest
dataclass 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.
entries
property 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.
set_entry
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.
get
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.
write
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.
load
classmethod 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.
_isoformat
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.
_posix
def _posix(path_like: str) -> str
Normalize to POSIX-style paths for portability.
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
path_like |
str |
— |
Returns
str