aea.components.base
This module contains definitions of agent components.
Component Objects
class Component(ABC, WithLogger)
Abstract class for an agent component.
__
init__
def __init__(configuration: Optional[ComponentConfiguration] = None,
is_vendor: bool = False,
**kwargs: Any) -> None
Initialize a package.
Arguments:
configuration
: the package configuration.is_vendor
: whether the package is vendorized.kwargs
: the keyword arguments for the logger.
component_
type
@property
def component_type() -> ComponentType
Get the component type.
is_
vendor
@property
def is_vendor() -> bool
Get whether the component is vendorized or not.
prefix_
import_
path
@property
def prefix_import_path() -> str
Get the prefix import path for this component.
component_
id
@property
def component_id() -> ComponentId
Ge the package id.
public_
id
@property
def public_id() -> PublicId
Get the public id.
configuration
@property
def configuration() -> ComponentConfiguration
Get the component configuration.
directory
@property
def directory() -> Path
Get the directory. Raise error if it has not been set yet.
directory
@directory.setter
def directory(path: Path) -> None
Set the directory. Raise error if already set.
build_
directory
@property
def build_directory() -> Optional[str]
Get build directory for the component.
load_
aea_
package
def load_aea_package(configuration: ComponentConfiguration) -> None
Load the AEA package from configuration.
It adds all the init.py modules into sys.modules
.
Arguments:
configuration
: the configuration object.
_
CheckUsedDependencies Objects
class _CheckUsedDependencies()
Auxiliary class to keep track of used packages in import statements of package modules.
__
init__
def __init__(configuration: ComponentConfiguration) -> None
Initialize the instance.
run_
check
def run_check() -> None
Run the check.
package_
id_
prefix_
to_
str
@classmethod
def package_id_prefix_to_str(cls, package_id_prefix: PackageIdPrefix) -> str
Get string from package id prefix.
perform_
load_
aea_
package
def perform_load_aea_package(dir_: Path, author: str, package_type_plural: str,
package_name: str) -> None
Load the AEA package from values provided.
It adds all the init.py modules into sys.modules
.
This function also checks that: - all packages declared as dependencies are used in package modules; - all imports correspond to a package declared as dependency.
Arguments:
dir_
: path of the component.author
: strpackage_type_plural
: strpackage_name
: str