Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ismael-sarmiento/kimera_python/llms.txt
Use this file to discover all available pages before exploring further.
ImportUtils is a static-method utility class that wraps Python’s importlib to provide safe, ergonomic helpers for runtime module management. Dynamic imports are essential in plugin systems where backends are optional — for example, a cache layer that supports Redis, Memcached, or an in-memory fallback should only attempt to import redis or pymemcache when those adapters are actually requested. ImportUtils handles that gracefully, offering existence checks, guarded imports, fully-qualified name resolution, and attribute discovery — all without requiring the caller to manage importlib directly.
Import
module_exists
Checks whether a module can be successfully imported and returns a boolean result. Internally it calls importlib.import_module and catches ModuleNotFoundError, making it safe to call even when the target package is not installed.
The dotted module name to check, e.g.
'redis' or 'components.tools.hash.md5'.Optional anchor package for resolving relative imports. Pass this when
module_name is a relative reference such as '.sibling_module'. Required when performing a relative import.True if the module is importable, False otherwise.
raise_exception_if_module_not_exists
A guard helper that combines the existence check with an immediate ModuleNotFoundError raise. Place this at the top of any adapter that depends on an optional package to produce an actionable error message before any attribute access is attempted on a missing module.
The dotted module name that must be importable.
Optional custom error message. When omitted, the default message is:
"Module '{module_name}' does not exist. Please add it!"ModuleNotFoundError if the module cannot be imported.
fullname
Resolves the fully-qualified class name — module.ClassName — for any live Python object. This is useful for serialization, logging, or building registry keys that must survive across process boundaries.
Any Python object whose class name should be resolved.
'components.tools.hash.md5.build_hash'. For built-in types whose module is builtins, only the class name is returned to avoid builtins.int-style noise.
get_parts_of_fullname
Splits a fully-qualified dotted name into its module path and terminal attribute name. The split always occurs at the last dot, so both class names and function names are handled uniformly.
A fully-qualified dotted name, e.g.
'components.tools.hash.md5.build_hash'.'module_name' and 'attribute_name' when the input contains at least one dot. Returns None implicitly when the input is a simple name with no dot (i.e. len(parts) <= 1).
get_attr_of_module
Dynamically imports a module by dotted name and retrieves a named attribute from it using getattr. This lets you defer imports until they are needed and reference functions or classes by string configuration values.
The fully-qualified dotted module name to import, e.g.
'components.tools.hash.md5'.The name of the attribute to retrieve from the imported module.
attribute_exist
A thin wrapper around Python’s built-in hasattr that fits naturally into the ImportUtils API when performing pre-flight checks before dynamic dispatch.
The object to inspect.
The attribute name to look up via
hasattr.True if the object has an attribute with the given name, False otherwise. The return type annotation in source is object, but the underlying hasattr call always returns a bool.