Skip to content

aea.package_manager.base

Base manager class.

load_configuration

def load_configuration(package_type: PackageType,
                       package_path: Path) -> PackageConfiguration

Load a configuration, knowing the type and the path to the package root.

Arguments:

  • package_type: the package type.
  • package_path: the path to the package root.

Returns:

the configuration object.

load_fetch_ipfs

def load_fetch_ipfs() -> Callable[[str, PublicId, str, bool], Optional[Path]]

Load fetch_ipfs method.

DepedencyMismatchErrors Objects

class DepedencyMismatchErrors(Enum)

Dependency mismatch errors.

Cache Objects

class Cache()

Cache manager.

__init__

def __init__() -> None

Package cache helper.

exists

def exists(package_hash: str) -> bool

Check if package exists in the cache.

add

def add(package_path: Path, package_hash: str) -> None

Add package to cache.

remove

def remove(package_hash: str) -> None

Remove package.

valid

def valid(package_hash: str) -> bool

Validate a package.

copy

def copy(package_hash: str, destination_path: Path) -> bool

Copy package from cache.

BasePackageManager Objects

class BasePackageManager(ABC)

AEA package manager

__init__

def __init__(path: Path,
             config_loader: ConfigLoaderCallableType = load_configuration,
             logger: Optional[logging.Logger] = None) -> None

Initialize object.

iter_dependency_tree

def iter_dependency_tree() -> Iterator[PackageId]

Iterate dependency tree.

check_dependencies

def check_dependencies(
    configuration: PackageConfiguration
) -> List[Tuple[PackageId, DepedencyMismatchErrors]]

Verify hashes for package dependecies againts the available hashes.

is_dependencies_hashes_match

def is_dependencies_hashes_match(
        package_id: PackageId,
        configuration_obj: PackageConfiguration) -> bool

Check dependecies hashes match and print errors

get_package_dependencies

def get_package_dependencies(package_id: PackageId) -> List[PackageId]

Get package dependencies by package_id.

update_public_id_hash

def update_public_id_hash(public_id_str: str, package_type: str) -> str

Update public id hash from the latest available hashes.

update_dependencies

def update_dependencies(package_id: PackageId) -> None

Update dependency hashes to latest for a package.

get_package_config_file

def get_package_config_file(package_id: PackageId) -> Path

Get package config file path.

update_fingerprints

def update_fingerprints(package_id: PackageId) -> None

Update fingerprints for a package.

add_package

def add_package(package_id: PackageId,
                with_dependencies: bool = False,
                allow_update: bool = False) -> "BasePackageManager"

Add package.

add_dependencies_for_package

def add_dependencies_for_package(package_id: PackageId,
                                 allow_update: bool = False) -> None

Add dependencies for the package specified.

get_package_version_with_hash

def get_package_version_with_hash(package_id: PackageId) -> PackageId

Add package_id with hash for the package presents in registry.

is_package_files_exist

def is_package_files_exist(package_id: PackageId) -> bool

Check package exists in the filesystem by checking it's config file exists.

package_path_from_package_id

def package_path_from_package_id(package_id: PackageId) -> Path

Get package path from the package id.

calculate_hash_from_package_id

def calculate_hash_from_package_id(package_id: PackageId) -> str

Calculate package hash from package id.

update_package

def update_package(package_id: PackageId) -> "BasePackageManager"

Update package.

register

@abstractmethod
def register(
        package_path: Path,
        package_type: Optional[PackageType] = None) -> "BasePackageManager"

Add package to the index.

get_package_hash

@abstractmethod
def get_package_hash(package_id: PackageId) -> Optional[str]

Return hash for the given package id.

sync

@abstractmethod
def sync(dev: bool = False,
         third_party: bool = True,
         update_packages: bool = False,
         update_hashes: bool = False) -> "BasePackageManager"

Sync local packages to the remote registry.

update_package_hashes

@abstractmethod
def update_package_hashes(selector_prompt: Optional[Callable[[], str]] = None,
                          skip_missing: bool = False) -> "BasePackageManager"

Update package.json file.

verify

@abstractmethod
def verify() -> int

Verify fingerprints and outer hash of all available packages.

json

@property
@abstractmethod
def json() -> OrderedDictType

Json representation

dump

def dump(file: Optional[Path] = None) -> None

Dump package data to file.

from_dir

@classmethod
@abstractmethod
def from_dir(
    cls,
    packages_dir: Path,
    config_loader: ConfigLoaderCallableType = load_configuration
) -> "BasePackageManager"

Initialize from packages directory.

PackageHashDoesNotMatch Objects

class PackageHashDoesNotMatch(Exception)

Package hash does not match error.

PackageUpdateError Objects

class PackageUpdateError(Exception)

Package update error.

PackageNotValid Objects

class PackageNotValid(Exception)

Package not valid.

PackageFileNotValid Objects

class PackageFileNotValid(Exception)

Package file not valid.

PackagesSourceNotValid Objects

class PackagesSourceNotValid(Exception)

Packages source not valid.