caikit.interfaces.ts.data_model.toolkit.optional_dependencies
This module encapsulates the core optional dependencies using lazy imports.
Attributes
Classes
A LazyModule is a module subclass that wraps another module but imports |
Functions
|
This method can be used to check whether a given optional dependency is |
Module Contents
- class caikit.interfaces.ts.data_model.toolkit.optional_dependencies.LazyModule(name: str, package: str | None = None)[source]
Bases:
types.ModuleTypeA LazyModule is a module subclass that wraps another module but imports it lazily and then aliases __getattr__ to the lazily imported module.
- __name
- __package = None
- __wrapped_module = None
- caikit.interfaces.ts.data_model.toolkit.optional_dependencies.have_module(name: str, package: str | None = None) bool[source]
This method can be used to check whether a given optional dependency is available and should primarily be used for assertions when coding defensively.
NOTE: Nested modules WILL force the import of parent modules
TODO: Move this to import_tracker
- Args:
- name: str
The name of the module
- package: Optional[str]
The qualifying package for the module under investigation
- Returns:
- have_module: bool
True if the module can be imported, False otherwise
- caikit.interfaces.ts.data_model.toolkit.optional_dependencies.pd
- caikit.interfaces.ts.data_model.toolkit.optional_dependencies.pyspark
- caikit.interfaces.ts.data_model.toolkit.optional_dependencies.HAVE_NUMPY
- caikit.interfaces.ts.data_model.toolkit.optional_dependencies.HAVE_PANDAS
- caikit.interfaces.ts.data_model.toolkit.optional_dependencies.HAVE_PYSPARK