sensai-utils
sensai-utils is a Python library providing general-purpose utilities extracted from the larger sensAI project. It allows users to leverage various helper functions and classes (e.g., for caching, logging, data structures) without incurring the additional dependencies of the full sensAI library. The current version is 1.6.0, with minor version releases occurring regularly.
Warnings
- gotcha The PyPI package name is `sensai-utils`, but the Python import path is `sensai.utils`. Attempting to import `sensai_utils` directly will result in an `ImportError`.
- gotcha `sensai-utils` is a subset of the larger `sensAI` library, specifically designed to be used without `sensAI`'s full set of dependencies. While its utilities are general-purpose, for deep AI-related functionalities, consider installing the full `sensAI` library.
- gotcha Documentation for `sensai-utils`'s `util` package is integrated into the main `sensAI` documentation. Users looking for detailed usage examples and API references should consult the `sensAI` documentation for the `util` package.
Install
-
pip install sensai-utils
Imports
- configure
import sensai_utils.logging
from sensai.utils.logging import configure
- ToStringMixin
from sensai.utils.string import ToStringMixin
Quickstart
from sensai.utils.logging import configure
import logging
import os
# Configure a basic logger for demonstration
log_file_path = os.path.join(os.getcwd(), 'sensai_utils_quickstart.log')
configure(log_file_path=log_file_path, verbosity=logging.INFO)
logger = logging.getLogger(__name__)
logger.info('sensai-utils logging configured successfully!')
print(f"Log messages written to: {log_file_path}")