caikit.interfaces.ts.data_model.toolkit.optional_dependencies ============================================================= .. py:module:: caikit.interfaces.ts.data_model.toolkit.optional_dependencies .. autoapi-nested-parse:: This module encapsulates the core optional dependencies using lazy imports. Attributes ---------- .. autoapisummary:: caikit.interfaces.ts.data_model.toolkit.optional_dependencies.log 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 Classes ------- .. autoapisummary:: caikit.interfaces.ts.data_model.toolkit.optional_dependencies.LazyModule Functions --------- .. autoapisummary:: caikit.interfaces.ts.data_model.toolkit.optional_dependencies.have_module Module Contents --------------- .. py:data:: log .. py:class:: LazyModule(name: str, package: Optional[str] = None) Bases: :py:obj:`types.ModuleType` A LazyModule is a module subclass that wraps another module but imports it lazily and then aliases __getattr__ to the lazily imported module. .. py:attribute:: __name .. py:attribute:: __package :value: None .. py:attribute:: __wrapped_module :value: None .. py:method:: __getattr__(name: str) -> any When asked for an attribute, make sure the wrapped module is imported and then delegate .. py:function:: have_module(name: str, package: Optional[str] = None) -> bool 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 .. py:data:: pd .. py:data:: pyspark .. py:data:: HAVE_NUMPY .. py:data:: HAVE_PANDAS .. py:data:: HAVE_PYSPARK