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.