Aura Complex Logic Framework files and libraries

Description of the files and libraries that integrate the Complex Logic Framework

requirements.txt file

This file contains Python module dependencies. By default, it includes two own libraries:

And other external ones used in the testing and verification stages:

  • flake8-htmlPylint
  • pytest-pylint
  • pytest-html

It is possible to include new dependencies in this file if required for the development of new plugins.

auracog-lib

auracog-lib library is a Python package containing a few basic classes & modules intended as helpers for Aura Cognitive applications, specifically:

  • Configuration: it contains AuConfig, wrapper for the standard Python ConfigParser with certain added functionality.
  • Logging: it contains LoggerWrapper, wrapper for the standard Python logging with certain added functionality.
  • Testing: it contains functionality used in test development.

auracog-plugins-lib

auracog-plugins-lib contains the necessary utilities for all the plugins, such as validators and metrics used in verification and performance scripts or plugin_base, the base class of all the plugins.

plugin_base.py file

This is an essential internal file in Aura Complex Logic Framework for its proper performance. This file contains the base class PluginBase, from which all the plugins that are developed will inherit.

All the plugins developed will be initialized with a configuration and a logger that will be passed to them as a parameter and they will have to necessarily develop an asynchronous run method. The run method is the main method of the plugin and will develop the activity for which the plugin has been designed. This method receives data, a dict with the JSON request as a parameter and it will return the JSON response as a dict.

It is also possible to use other auxiliary methods if developers consider it.

from typing import Dict

from auracog_lib.aura_logging import logger_wrapper
from auracog_lib.code_utilities.type_hints_utilities import TypeHintsUtilitie
from auracog_lib.utils.exception import AuraAbstractException


class PluginBase:

    def __init__(self, cfg: Dict, log: logger_wrapper.LoggerWrapper):
        """
        Init method. No overload is required.
        
        :param cfg: a dict with the configuration for plugins.
        :param log: a logger object that implements the usual info, debug and error methods.
        """
        self.cfg = cfg
        self.log = log
        
    async def run(self, data: TypeHintsUtilities.Json) -> TypeHintsUtilities.Json:
        """
        Overload this methods in your custom plugins.
        
        :param data: A dict with the JSON request.
        :return: The JSON response that will be returned as a dict.
        """
        raise AuraAbstractException