pyboxbuilder.deps.require

pyboxbuilder.deps.require(module: str, purpose: str) → ModuleType[source]

Import a hard dependency, or explain what is missing.

Parameters:
module: str

The import name, e.g. "pybosl2".

purpose: str

What the caller needed it for, as a verb phrase — it finishes the sentence “pyboxbuilder needs module to …”. This is what tells a user which part of their project stopped working.

Returns:

The imported module.

Raises:

MissingDependencyError – If it is not installed.