aiidalab package

Submodules

aiidalab.__main__ module

Module that implements a basic command line interface (CLI) for AiiDAlab.

aiidalab.__main__._find_app_and_releases(app_requirement)[source]

Find app and a suitable release for a given requirement.

aiidalab.__main__._find_registered_app_from_id(name)[source]

Find app for a given requirement.

aiidalab.__main__._find_version_to_install(app_requirement, force, dependencies, python_bin, prereleases)[source]
aiidalab.__main__._list_apps(apps_path)[source]
aiidalab.__main__._mock_schemas_endpoints()[source]
aiidalab.__main__._parse_requirement(app_requirement)[source]
aiidalab.__main__._spinner_with_message(message, message_final='Done.\n', **kwargs)[source]
aiidalab.__main__._tabulate_apps(apps, headers=('App name', 'Version', 'Path'), **kwargs)[source]

aiidalab.app module

Module to manage AiiDAlab apps.

class aiidalab.app.AiidaLabApp(**kwargs)[source]

Bases: traitlets.traitlets.HasTraits

Manage installation status of an AiiDAlab app.

Arguments:

name (str):

Name of the Aiida lab app.

app_data (dict):

Dictionary containing the app metadata.

aiidalab_apps_path (str):

Path to directory at which the app is expected to be installed.

watch (bool):

If true (default), automatically watch the repository for changes.

__init__(name, app_data, aiidalab_apps_path, watch=True)[source]

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'aiidalab.app'
__str__()[source]

Return str(self).

_default_busy
_default_compatible
_default_detached
_default_include_prereleases
_get_from_metadata(what)[source]

Get information from metadata.

_has_git_repo()[source]

Check if the app has a .git folder in it.

_installed_version()[source]

Determine the currently installed version.

_is_compatible(app_version)[source]

Determine whether the specified version is compatible.

_observe_include_prereleases
_refresh_versions()[source]
_remote_update_status()[source]

Determine whether there are updates available.

For this the app must be installed in a known version and there must be available (and compatible) versions.

property _repo

Returns Git repository.

_show_busy()[source]

Apply this decorator to indicate that the app is busy during execution.

_trait_default_generators = {'busy': <traitlets.traitlets.DefaultHandler object>, 'compatible': <traitlets.traitlets.DefaultHandler object>, 'detached': <traitlets.traitlets.DefaultHandler object>, 'include_prereleases': <traitlets.traitlets.DefaultHandler object>}
property authors
available_versions

An instance of a Python list.

busy

A boolean (True, False) trait.

compatibility_info

An instance of a Python dict.

One or more traits can be passed to the constructor to validate the keys and/or values of the dict. If you need more detailed validation, you may use a custom validator method.

Changed in version 5.0: Added key_trait for validating dict keys.

Changed in version 5.0: Deprecated ambiguous trait, traits args in favor of value_trait, per_key_traits.

compatible

A boolean (True, False) trait.

property description
detached

A boolean (True, False) trait.

has_prereleases

A boolean (True, False) trait.

in_category(category)[source]
include_prereleases

A boolean (True, False) trait.

install_app(version=None, stdout=None)[source]

Installing the app.

install_info

A trait for unicode strings.

installed_version

A trait type representing a Union type.

property metadata

Return metadata dictionary. Give the priority to the local copy (better for the developers).

property more
path

A trait for unicode strings.

refresh()[source]

Refresh app state.

refresh_async()[source]

Asynchronized (non-blocking) refresh of the app state.

remote_update_status

Use a Enum class as model for the data type description. Note that if no default-value is provided, the first enum-value is used as default-value.

# -- SINCE: Python 3.4 (or install backport: pip install enum34)
import enum
from traitlets import HasTraits, UseEnum

class Color(enum.Enum):
    red = 1         # -- IMPLICIT: default_value
    blue = 2
    green = 3

class MyEntity(HasTraits):
    color = UseEnum(Color, default_value=Color.blue)

entity = MyEntity(color=Color.red)
entity.color = Color.green    # USE: Enum-value (preferred)
entity.color = "green"        # USE: name (as string)
entity.color = "Color.green"  # USE: scoped-name (as string)
entity.color = 3              # USE: number (as int)
assert entity.color is Color.green
property title
uninstall_app(_=None)[source]

Perfrom app uninstall.

update_app(_=None, stdout=None)[source]

Perform app update.

property url

Provide explicit link to Git repository.

class aiidalab.app.AiidaLabAppWatch(app)[source]

Bases: object

Watch to monitor the app installation status.

Create a watch instance to monitor the installation status of an AiiDAlab app. This is achieved by monitoring the app repository for existance and changes.

Arguments:
app (AiidaLabApp):

The AiidaLab app to monitor.

class AppPathFileSystemEventHandler(app)[source]

Bases: watchdog.events.FileSystemEventHandler

Internal event handeler for app path file system events.

__init__(app)[source]

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'aiidalab.app'
on_any_event(event)[source]

Refresh app for any event.

__dict__ = mappingproxy({'__module__': 'aiidalab.app', '__doc__': 'Watch to monitor the app installation status.\n\n    Create a watch instance to monitor the installation status of an\n    AiiDAlab app. This is achieved by monitoring the app repository\n    for existance and changes.\n\n    Arguments:\n        app (AiidaLabApp):\n            The AiidaLab app to monitor.\n    ', 'AppPathFileSystemEventHandler': <class 'aiidalab.app.AiidaLabAppWatch.AppPathFileSystemEventHandler'>, '__init__': <function AiidaLabAppWatch.__init__>, '__repr__': <function AiidaLabAppWatch.__repr__>, '_start_observer': <function AiidaLabAppWatch._start_observer>, '_stop_observer': <function AiidaLabAppWatch._stop_observer>, 'start': <function AiidaLabAppWatch.start>, 'stop': <function AiidaLabAppWatch.stop>, 'is_alive': <function AiidaLabAppWatch.is_alive>, 'join': <function AiidaLabAppWatch.join>, '__dict__': <attribute '__dict__' of 'AiidaLabAppWatch' objects>, '__weakref__': <attribute '__weakref__' of 'AiidaLabAppWatch' objects>, '__annotations__': {}})
__init__(app)[source]

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'aiidalab.app'
__repr__()[source]

Return repr(self).

__weakref__

list of weak references to the object (if defined)

_start_observer()[source]

Start the directory observer thread.

The ._observer thread is controlled by the ._monitor_thread.

_stop_observer()[source]

Stop the directory observer thread.

The ._observer thread is controlled by the ._monitor_thread.

is_alive()[source]

Return True if this watch is still alive.

join(timeout=None)[source]

Join the watch after stopping.

This function will timeout if a timeout argument is provided. Use the is_alive() function to determien whether the watch was stopped within the given timout.

start()[source]

Watch the app repository for file system events.

The app state is refreshed automatically for all events.

stop()[source]

Stop watching the app repository for file system events.

exception aiidalab.app.AppNotInstalledException[source]

Bases: Exception

__module__ = 'aiidalab.app'
__weakref__

list of weak references to the object (if defined)

class aiidalab.app.AppRemoteUpdateStatus(value)[source]

Bases: enum.Flag

An enumeration.

CANNOT_REACH_REGISTRY = 8
DETACHED = 16
NOT_REGISTERED = 1
UPDATE_AVAILABLE = 4
UP_TO_DATE = 2
__module__ = 'aiidalab.app'
class aiidalab.app.AppVersion(value)[source]

Bases: enum.Enum

An enumeration.

NOT_INSTALLED = 2
UNKNOWN = 1
__module__ = 'aiidalab.app'
class aiidalab.app._AiidaLabApp(metadata: dict, name: str, path: pathlib.Path, releases: dict = <factory>)[source]

Bases: object

__annotations__ = {'metadata': <class 'dict'>, 'name': <class 'str'>, 'path': <class 'pathlib.Path'>, 'releases': <class 'dict'>}
__dataclass_fields__ = {'metadata': Field(name='metadata',type=<class 'dict'>,default=<dataclasses._MISSING_TYPE object>,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'name': Field(name='name',type=<class 'str'>,default=<dataclasses._MISSING_TYPE object>,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'path': Field(name='path',type=<class 'pathlib.Path'>,default=<dataclasses._MISSING_TYPE object>,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'releases': Field(name='releases',type=<class 'dict'>,default=<dataclasses._MISSING_TYPE object>,default_factory=<class 'dict'>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD)}
__dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
__dict__ = mappingproxy({'__module__': 'aiidalab.app', '__annotations__': {'metadata': <class 'dict'>, 'name': <class 'str'>, 'path': <class 'pathlib.Path'>, 'releases': <class 'dict'>}, 'from_registry_entry': <classmethod object>, '_registry_entry_from_path': <classmethod object>, 'from_id': <classmethod object>, 'is_registered': <property object>, '_repo': <property object>, 'installed_version': <function _AiidaLabApp.installed_version>, 'available_versions': <function _AiidaLabApp.available_versions>, 'dirty': <function _AiidaLabApp.dirty>, 'is_installed': <function _AiidaLabApp.is_installed>, 'remote_update_status': <function _AiidaLabApp.remote_update_status>, '_move_to_trash': <function _AiidaLabApp._move_to_trash>, '_restore_from': <function _AiidaLabApp._restore_from>, 'uninstall': <function _AiidaLabApp.uninstall>, 'find_matching_releases': <function _AiidaLabApp.find_matching_releases>, '_find_incompatibilities_python': <staticmethod object>, 'find_incompatibilities': <function _AiidaLabApp.find_incompatibilities>, 'is_compatible': <function _AiidaLabApp.is_compatible>, '_install_dependencies': <function _AiidaLabApp._install_dependencies>, '_install_from_path': <function _AiidaLabApp._install_from_path>, '_install_from_https': <function _AiidaLabApp._install_from_https>, '_install_from_git_repository': <function _AiidaLabApp._install_from_git_repository>, 'install': <function _AiidaLabApp.install>, '__dict__': <attribute '__dict__' of '_AiidaLabApp' objects>, '__weakref__': <attribute '__weakref__' of '_AiidaLabApp' objects>, '__doc__': '_AiidaLabApp(metadata: dict, name: str, path: pathlib.Path, releases: dict = <factory>)', '__dataclass_params__': _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False), '__dataclass_fields__': {'metadata': Field(name='metadata',type=<class 'dict'>,default=<dataclasses._MISSING_TYPE object>,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'name': Field(name='name',type=<class 'str'>,default=<dataclasses._MISSING_TYPE object>,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'path': Field(name='path',type=<class 'pathlib.Path'>,default=<dataclasses._MISSING_TYPE object>,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'releases': Field(name='releases',type=<class 'dict'>,default=<dataclasses._MISSING_TYPE object>,default_factory=<class 'dict'>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD)}, '__init__': <function __create_fn__.<locals>.__init__>, '__repr__': <function __create_fn__.<locals>.__repr__>, '__eq__': <function __create_fn__.<locals>.__eq__>, '__hash__': None})
__eq__(other)

Return self==value.

__hash__ = None
__init__(metadata: dict, name: str, path: pathlib.Path, releases: dict = <factory>)None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'aiidalab.app'
__repr__()

Return repr(self).

__weakref__

list of weak references to the object (if defined)

static _find_incompatibilities_python(requirements, python_bin)[source]
_install_dependencies(python_bin, stdout=None)[source]

Try to install the app dependencies with pip (if specified).

_install_from_git_repository(git_url)[source]
_install_from_https(url)[source]
_install_from_path(path)[source]
_move_to_trash()[source]
classmethod _registry_entry_from_path(path)[source]
property _repo
_restore_from(trash_path)[source]
available_versions()[source]
dirty()[source]
find_incompatibilities(version, python_bin=None)[source]
find_matching_releases(specifier, prereleases=None)[source]
classmethod from_id(app_id, registry_entry=None, apps_path=None)[source]
classmethod from_registry_entry(path, registry_entry)[source]
install(version=None, python_bin=None, install_dependencies=True, stdout=None, prereleases=False)[source]
installed_version()[source]
is_compatible(version, python_bin=None)[source]
is_installed()[source]

The app is installed if the corresponding folder is present.

property is_registered
metadata: dict
name: str
path: pathlib.Path
releases: dict
remote_update_status(prereleases=False)[source]

Determine the remote update satus.

Arguments:
prereleases (Bool):

Set to True to include available preleases. Defaults to False.

Returns:

AppRemoteUpdateStatus

uninstall()[source]

aiidalab.config module

Module to manange AiiDAlab configuration.

aiidalab.config._as_env_var_name(key)[source]
aiidalab.config._get_config_value(key, default=None)[source]

Return config value from configuration source.

The standard configuration source order is:

  1. environment variables

  2. local configuration

In ‘develop’ mode the order is reversed to simplify local override of configuration values.

The convention for environment variables it to prefix keys with AIIDALAB_ and to convert all letters to uppercase. For example, the configuration key registry is interpreted as AIIDALAB_REGISTRY when sourced as an environment variable.

aiidalab.environment module

App environment specification

The specification is used to describe a reproducible environment for a specific app, similar to the Reproducible Environment Specification (REES) [1]

[1] https://repo2docker.readthedocs.io/en/latest/specification.html

The following configuration files are recognized with the order of precedence matching the order shown here:

setup.cfg

Requirements listed as part of the [options]/install_requires field are parsed as pip-installable Python requirements for this app.

requirements.txt

Requirements listed within this file are parsed as pip-installable Python requirements for this app unless already parsed from the setup.cfg file.

class aiidalab.environment.Environment(python_requirements: List[str] = <factory>)[source]

Bases: object

App environment specification.

This dataclass contains the specification of an app environment and can be used to scan an existing environment configuration from a given path and to detect whether a given environment is meeting the specification.

_FILES = ('requirements.txt',)
__annotations__ = {'python_requirements': typing.List[str]}
__dataclass_fields__ = {'python_requirements': Field(name='python_requirements',type=typing.List[str],default=<dataclasses._MISSING_TYPE object>,default_factory=<class 'list'>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD)}
__dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
__dict__ = mappingproxy({'__module__': 'aiidalab.environment', '__annotations__': {'python_requirements': typing.List[str]}, '__doc__': 'App environment specification.\n\n    This dataclass contains the specification of an app environment and can be\n    used to scan an existing environment configuration from a given path and to\n    detect whether a given environment is meeting the specification.\n    ', '_FILES': ('requirements.txt',), '_scan': <staticmethod object>, 'scan': <classmethod object>, '__dict__': <attribute '__dict__' of 'Environment' objects>, '__weakref__': <attribute '__weakref__' of 'Environment' objects>, '__dataclass_params__': _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False), '__dataclass_fields__': {'python_requirements': Field(name='python_requirements',type=typing.List[str],default=<dataclasses._MISSING_TYPE object>,default_factory=<class 'list'>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD)}, '__init__': <function __create_fn__.<locals>.__init__>, '__repr__': <function __create_fn__.<locals>.__repr__>, '__eq__': <function __create_fn__.<locals>.__eq__>, '__hash__': None})
__eq__(other)

Return self==value.

__hash__ = None
__init__(python_requirements: List[str] = <factory>)None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'aiidalab.environment'
__repr__()

Return repr(self).

__weakref__

list of weak references to the object (if defined)

static _scan(path)[source]
python_requirements: List[str]
classmethod scan(root)[source]

Scan the root path and determine the environment specification.

aiidalab.fetch module

aiidalab.fetch._fetch_from_git_https(git_url)[source]
aiidalab.fetch._fetch_from_git_local(git_url)[source]
aiidalab.fetch._fetch_from_https(url)[source]
aiidalab.fetch._fetch_from_path(path)[source]
aiidalab.fetch._parse_git_url(git_url)[source]
aiidalab.fetch._this_or_only_subdir(path)[source]
aiidalab.fetch.fetch_from_url(url)[source]

aiidalab.git_util module

Utility module for git-managed AiiDAlab apps.

class aiidalab.git_util.BranchTrackingStatus(value)[source]

Bases: enum.Enum

Descripe the tracking status of a branch.

AHEAD = 1
BEHIND = -1
DIVERGED = 2
EQUAL = 0
__module__ = 'aiidalab.git_util'
class aiidalab.git_util.GitManagedAppRepo(root, object_store=None, bare=None)[source]

Bases: dulwich.repo.Repo

Utility class to simplify management of git-based apps.

__module__ = 'aiidalab.git_util'
_get_branch_for_ref(ref)[source]

Get the branch name for a given reference.

branch()[source]

Return the current branch.

Raises RuntimeError if the repository is in a detached HEAD state.

dirty()[source]

Check if there are likely local user modifications to the app repository.

get_branch_tracking_status(branch)[source]

Return the tracking status of branch.

get_tracked_branch(branch=None)[source]

Return the tracked branch for a given branch or None if the branch is not tracking.

list_branches()[source]

List all repository branches.

update_available()[source]

Check whether there non-pulled commits on the tracked branch.

class aiidalab.git_util.GitPath(repo: pathlib.Path, commit: str, path: pathlib.Path = PosixPath('.'))[source]

Bases: os.PathLike

Utility class to operate on git objects like path objects.

__abstractmethods__ = frozenset({})
__annotations__ = {'commit': <class 'str'>, 'path': <class 'pathlib.Path'>, 'repo': <class 'pathlib.Path'>}
__dataclass_fields__ = {'commit': Field(name='commit',type=<class 'str'>,default=<dataclasses._MISSING_TYPE object>,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'path': Field(name='path',type=<class 'pathlib.Path'>,default=PosixPath('.'),default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'repo': Field(name='repo',type=<class 'pathlib.Path'>,default=<dataclasses._MISSING_TYPE object>,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD)}
__dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
__eq__(other)

Return self==value.

__fspath__()[source]

Return the file system path representation of the object.

__hash__ = None
__init__(repo: pathlib.Path, commit: str, path: pathlib.Path = PosixPath('.'))None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'aiidalab.git_util'
__repr__()

Return repr(self).

_abc_impl = <_abc_data object>
_get_type()[source]
commit: str
is_dir()[source]
is_file()[source]
joinpath(*other)[source]
path: pathlib.Path = PosixPath('.')
read_bytes()[source]
read_text(encoding=None, errors=None)[source]
repo: pathlib.Path
resolve(strict=False)[source]
class aiidalab.git_util.GitRepo(root, object_store=None, bare=None)[source]

Bases: dulwich.repo.Repo

__module__ = 'aiidalab.git_util'
classmethod clone_from_url(url, path)[source]
get_commit_for_tag(tag)[source]
get_current_branch()[source]
get_merged_tags(branch)[source]
ref_from_rev(rev)[source]

Determine ref from rev.

Returns branch reference if a branch with that name exists, otherwise a tag reference, otherwise the rev itself (assuming it is a commit id).

rev_list(rev_selection)[source]
aiidalab.git_util.git_clone(url, commit, path)[source]

aiidalab.metadata module

App metadata specification

class aiidalab.metadata.Metadata(title: str, description: str, authors: Optional[str] = None, state: Optional[str] = None, documentation_url: Optional[str] = None, external_url: Optional[str] = None, logo: Optional[str] = None, categories: List[str] = <factory>, version: Optional[str] = None)[source]

Bases: object

App metadata specification.

__annotations__ = {'authors': <class 'str'>, 'categories': typing.List[str], 'description': <class 'str'>, 'documentation_url': <class 'str'>, 'external_url': <class 'str'>, 'logo': <class 'str'>, 'state': <class 'str'>, 'title': <class 'str'>, 'version': <class 'str'>}
__dataclass_fields__ = {'authors': Field(name='authors',type=<class 'str'>,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'categories': Field(name='categories',type=typing.List[str],default=<dataclasses._MISSING_TYPE object>,default_factory=<class 'list'>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'description': Field(name='description',type=<class 'str'>,default=<dataclasses._MISSING_TYPE object>,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'documentation_url': Field(name='documentation_url',type=<class 'str'>,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'external_url': Field(name='external_url',type=<class 'str'>,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'logo': Field(name='logo',type=<class 'str'>,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'state': Field(name='state',type=<class 'str'>,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'title': Field(name='title',type=<class 'str'>,default=<dataclasses._MISSING_TYPE object>,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'version': Field(name='version',type=<class 'str'>,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD)}
__dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
__dict__ = mappingproxy({'__module__': 'aiidalab.metadata', '__annotations__': {'title': <class 'str'>, 'description': <class 'str'>, 'authors': <class 'str'>, 'state': <class 'str'>, 'documentation_url': <class 'str'>, 'external_url': <class 'str'>, 'logo': <class 'str'>, 'categories': typing.List[str], 'version': <class 'str'>}, '__doc__': 'App metadata specification.', 'authors': None, 'state': None, 'documentation_url': None, 'external_url': None, 'logo': None, 'version': None, '_search_dirs': ('.aiidalab', './'), '_parse': <staticmethod object>, 'parse': <classmethod object>, '__dict__': <attribute '__dict__' of 'Metadata' objects>, '__weakref__': <attribute '__weakref__' of 'Metadata' objects>, '__dataclass_params__': _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False), '__dataclass_fields__': {'title': Field(name='title',type=<class 'str'>,default=<dataclasses._MISSING_TYPE object>,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'description': Field(name='description',type=<class 'str'>,default=<dataclasses._MISSING_TYPE object>,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'authors': Field(name='authors',type=<class 'str'>,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'state': Field(name='state',type=<class 'str'>,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'documentation_url': Field(name='documentation_url',type=<class 'str'>,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'external_url': Field(name='external_url',type=<class 'str'>,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'logo': Field(name='logo',type=<class 'str'>,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'categories': Field(name='categories',type=typing.List[str],default=<dataclasses._MISSING_TYPE object>,default_factory=<class 'list'>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD), 'version': Field(name='version',type=<class 'str'>,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),_field_type=_FIELD)}, '__init__': <function __create_fn__.<locals>.__init__>, '__repr__': <function __create_fn__.<locals>.__repr__>, '__eq__': <function __create_fn__.<locals>.__eq__>, '__hash__': None})
__eq__(other)

Return self==value.

__hash__ = None
__init__(title: str, description: str, authors: Optional[str] = None, state: Optional[str] = None, documentation_url: Optional[str] = None, external_url: Optional[str] = None, logo: Optional[str] = None, categories: List[str] = <factory>, version: Optional[str] = None)None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'aiidalab.metadata'
__repr__()

Return repr(self).

__weakref__

list of weak references to the object (if defined)

static _parse(path)[source]
_search_dirs = ('.aiidalab', './')
authors: str = None
categories: List[str]
description: str
documentation_url: str = None
external_url: str = None
classmethod parse(root)[source]

Parse the app metadata from a setup.cfg within the app repository.

This function will parse metadata fields from a possible “aiidalab” section, but falls back to the standard fields defined as part of the PEP 426-compliant metadata section for any missing values.

state: str = None
title: str
version: str = None

aiidalab.utils module

Helpful utilities for the AiiDAlab tools.

class aiidalab.utils.PEP508CompliantUrl[source]

Bases: str

Represents a PEP 508 compliant URL.

__dict__ = mappingproxy({'__module__': 'aiidalab.utils', '__doc__': 'Represents a PEP 508 compliant URL.', '__dict__': <attribute '__dict__' of 'PEP508CompliantUrl' objects>, '__weakref__': <attribute '__weakref__' of 'PEP508CompliantUrl' objects>, '__annotations__': {}})
__module__ = 'aiidalab.utils'
__weakref__

list of weak references to the object (if defined)

class aiidalab.utils.Package(name, version)[source]

Bases: object

Helper class to check whether a given package fulfills a requirement.

__dict__ = mappingproxy({'__module__': 'aiidalab.utils', '__doc__': 'Helper class to check whether a given package fulfills a requirement.', '__init__': <function Package.__init__>, '__str__': <function Package.__str__>, 'fulfills': <function Package.fulfills>, '__dict__': <attribute '__dict__' of 'Package' objects>, '__weakref__': <attribute '__weakref__' of 'Package' objects>, '__annotations__': {}})
__init__(name, version)[source]

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'aiidalab.utils'
__str__()[source]

Return str(self).

__weakref__

list of weak references to the object (if defined)

fulfills(requirement)[source]

Returns True if this entry fullfills the requirement.

aiidalab.utils.find_installed_packages(python_bin=None)[source]

Return all currently installed packages.

aiidalab.utils.load_app_registry_entry(app_id)[source]

Load registry enty for app with app_id.

aiidalab.utils.load_app_registry_index()[source]

Load apps’ information from the AiiDAlab registry.

aiidalab.utils.parse_app_repo(url, metadata_fallback=None)[source]

Parse an app repo for metadata and other information.

Use this function to parse a local or remote app repository for the app metadata and environment specification.

Examples:

For a local app repository, provide the absolute or relative path:

url=”/path/to/aiidalab-hello-world”

For a remote app repository, provide a PEP 508 compliant URL, for example:

url=”git+https://github.com/aiidalab/aiidalab-hello-world.git@v1.0.0”

aiidalab.utils.run_pip_install(*args, python_bin='/home/docs/checkouts/readthedocs.org/user_builds/aiidalab/envs/develop/bin/python')[source]
aiidalab.utils.run_reentry_scan()[source]
aiidalab.utils.run_verdi_daemon_restart()[source]
aiidalab.utils.split_git_url(git_url)[source]

Split the base url and the ref pointer of a git url.

For example: git+https://example.com/app.git@v1 is split into and returned as tuple: (git+https://example.com/app.git, v1)

aiidalab.utils.this_or_only_subdir(path)[source]
class aiidalab.utils.throttled(calls_per_second=1)[source]

Bases: object

Decorator to throttle calls to a function to a specified rate.

The throttle is specific to the first argument of the wrapped function. That means for class methods it is specific to each instance.

Adapted from: https://gist.github.com/gregburek/1441055

__call__(func)[source]

Return decorator function.

__dict__ = mappingproxy({'__module__': 'aiidalab.utils', '__doc__': 'Decorator to throttle calls to a function to a specified rate.\n\n    The throttle is specific to the first argument of the wrapped\n    function. That means for class methods it is specific to each\n    instance.\n\n    Adapted from: https://gist.github.com/gregburek/1441055\n\n    ', '__init__': <function throttled.__init__>, '__call__': <function throttled.__call__>, '__dict__': <attribute '__dict__' of 'throttled' objects>, '__weakref__': <attribute '__weakref__' of 'throttled' objects>, '__annotations__': {}})
__init__(calls_per_second=1)[source]

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'aiidalab.utils'
__weakref__

list of weak references to the object (if defined)

Module contents

AiiDAlab core tools.