Skip to content

angee.resources.sources

Registry of resource source types.

A resource entry names its source by a manifest key — path for a local file, url for a remote one. The resources addon owns the source-type seam but ships only the local path source; an addon that owns outbound networking, angee.integrate, contributes the url source through settings, so resources itself stays free of any network concern. Each source declares how to normalize its manifest value and how to materialize an entry to a local file.

ResourceSource

python
@dataclass(frozen=True, slots=True)
class ResourceSource()

One resource source type, keyed by its manifest key (path/url).

key

The manifest key that selects this source in a resource declaration.

normalize

Return the stored source value from one raw manifest value.

materialize

Return the local file path for one entry, fetching/resolving as needed.

source_registry

python
def source_registry() -> dict[str, ResourceSource]

Return resource source types declared by settings.

source_keys

python
def source_keys() -> frozenset[str]

Return every configured source key.

get_source

python
def get_source(key: str) -> ResourceSource

Return the configured source for key, or raise with an install hint.

path_source

python
def path_source() -> ResourceSource

Return the built-in local-file resource source.

normalize_path

python
def normalize_path(app_config: AppConfig, value: object) -> str

Return one safe path relative to app_config.path.

materialize_path

python
def materialize_path(entry: ResourceEntry) -> Path

Materialize a local path source to its addon-relative file.

Released under the AGPL-3.0 License.