coco_pipe.utils¶
Shared package utilities.
This module holds small helpers that are not specific to one subpackage.
Functions¶
|
Lazily import an optional dependency with clearer failure modes. |
Module Contents¶
- coco_pipe.utils.import_optional_dependency(loader: Any, feature: str, dependency: str, install_hint: str | None = None) Any[source]¶
Lazily import an optional dependency with clearer failure modes.
- Parameters:
loader (callable) – Zero-argument callable returning the imported dependency.
feature (str) – Feature or component name using the dependency.
dependency (str) – Human-readable dependency name.
install_hint (str, optional) – Installation hint shown on ImportError.
- Returns:
Imported dependency returned by
loader.- Return type:
Any
- Raises:
ImportError – If the dependency is not installed.
RuntimeError – If the dependency is installed but fails during initialization.