simvx.core.asset_resolver¶
Asset path resolution.
resolve_asset_path is the engine’s single canonical way to turn an asset
specification into a filesystem :class:~pathlib.Path. It accepts:
- class:
str/ :class:os.PathLike– a filesystem path, absolute or resolved relative to project_root (or the current working directory).
- class:
~simvx.core.resource.Resource– a Python-package handle, looked up via :mod:importlib.resources.
- class:
importlib.resources.abc.Traversable– the raw return type ofimportlib.resources.files(pkg) / name; resolved to a real path via- func:
importlib.resources.as_file.
Strict by default: missing files raise :class:FileNotFoundError, missing
packages raise :class:ModuleNotFoundError, anything else raises
- class:
TypeError. There are no URI schemes – strings are paths.
Module Contents¶
Functions¶
Resolve spec to a filesystem :class: |
Data¶
API¶
- simvx.core.asset_resolver.AssetSpec¶
None
- simvx.core.asset_resolver.resolve_asset_path(spec: simvx.core.asset_resolver.AssetSpec, project_root: pathlib.Path | None = None) pathlib.Path[source]¶
Resolve spec to a filesystem :class:
Path.str/os.PathLike: filesystem path. Absolute paths pass through; relative paths resolve from project_root (or the CWD).Resource: package + name resolved via :mod:importlib.resources.Traversable: package-resource handle resolved via- func:
importlib.resources.as_file.
Raises :class:
TypeErrorfor any other type, :class:FileNotFoundErrorif the resolved file is missing, and :class:ModuleNotFoundErrorif a Resource references a package that cannot be imported.