aiida.plugins package

Classes and functions to load and interact with plugin classes accessible through defined entry points.

aiida.plugins.load_entry_point(group, name)[source]

Load the class registered under the entry point for a given name and group

Parameters:
  • group – the entry point group
  • name – the name of the entry point
Returns:

class registered at the given entry point

Raises:
aiida.plugins.load_entry_point_from_string(entry_point_string)[source]

Load the class registered for a given entry point string that determines group and name

Parameters:

entry_point_string – the entry point string

Returns:

class registered at the given entry point

Raises:
aiida.plugins.BaseFactory(group, name)[source]

Return the plugin class registered under a given entry point group and name.

Parameters:
  • group – entry point group
  • name – entry point name
Returns:

the plugin class

Raises:
aiida.plugins.CalculationFactory(entry_point)[source]

Return the CalcJob sub class registered under the given entry point.

Parameters:entry_point – the entry point name
Returns:sub class of CalcJob
aiida.plugins.DataFactory(entry_point)[source]

Return the Data sub class registered under the given entry point.

Parameters:entry_point – the entry point name
Returns:sub class of Data
aiida.plugins.DbImporterFactory(entry_point)[source]

Return the DbImporter sub class registered under the given entry point.

Parameters:entry_point – the entry point name
Returns:sub class of DbImporter
aiida.plugins.OrbitalFactory(entry_point)[source]

Return the Orbital sub class registered under the given entry point.

Parameters:entry_point – the entry point name
Returns:sub class of Orbital
aiida.plugins.ParserFactory(entry_point)[source]

Return the Parser sub class registered under the given entry point.

Parameters:entry_point – the entry point name
Returns:sub class of Parser
aiida.plugins.SchedulerFactory(entry_point)[source]

Return the Scheduler sub class registered under the given entry point.

Parameters:entry_point – the entry point name
Returns:sub class of Scheduler
aiida.plugins.TransportFactory(entry_point)[source]

Return the Transport sub class registered under the given entry point.

Parameters:entry_point – the entry point name
Returns:sub class of Transport
aiida.plugins.WorkflowFactory(entry_point)[source]

Return the WorkChain sub class registered under the given entry point.

Parameters:entry_point – the entry point name
Returns:sub class of WorkChain

Submodules

Cached information for each plugin.

This module and the RegistryEntry class should be the sole location for the (implicit) definition of the registry format.

exception aiida.plugins.entry.InvalidPluginEntryError(msg='')[source]

Bases: Exception

__init__(msg='')[source]

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

__module__ = 'aiida.plugins.entry'
__weakref__

list of weak references to the object (if defined)

class aiida.plugins.entry.RegistryEntry(**kwargs)[source]

Bases: object

Can be created from an entry in the online aiida plugin registry. An instance will be created and cached for each entry on update.

__dict__ = mappingproxy({'__module__': 'aiida.plugins.entry', '__doc__': '\n Can be created from an entry in the online aiida plugin registry.\n An instance will be created and cached for each entry on update.\n ', '__init__': <function RegistryEntry.__init__>, 'load_setup_info': <function RegistryEntry.load_setup_info>, 'package_name': <property object>, 'version': <property object>, 'entry_points_raw': <property object>, 'entry_point_categories': <property object>, 'entry_points': <property object>, 'cli_apps': <property object>, 'gui_apps': <property object>, 'install': <function RegistryEntry.install>, 'test_installed': <function RegistryEntry.test_installed>, 'install_requirements': <property object>, 'extras_requirements': <property object>, 'author': <property object>, 'author_email': <property object>, 'description': <property object>, 'tags': <property object>, 'home_url': <property object>, 'installed': <property object>, 'format_info': <function RegistryEntry.format_info>, '__dict__': <attribute '__dict__' of 'RegistryEntry' objects>, '__weakref__': <attribute '__weakref__' of 'RegistryEntry' objects>})
__init__(**kwargs)[source]

stores registry entry keys and loads the setup_info from the url given in plugin_info

__module__ = 'aiida.plugins.entry'
__weakref__

list of weak references to the object (if defined)

author
author_email
cli_apps

A list of cli apps installed by this plugin

description
entry_point_categories

A list of categories for which this plugin exposes entry points

entry_points

A dict of entry point names by category

entry_points_raw

The full entry point spec in setuptools.setup() format

extras_requirements
format_info(**kwargs)[source]

format and return a datastructure containing all known information about the plugin

Parameters:
  • format – str, one of [tabulate | dict] tabulate: use tabulate to create and return a table of properties as a string dict: create a dict of properties
  • as_str – bool format=’dict’ and as_str=True: return a pretty printed string version of the dict format=’dict’ and as_str=False: return a dictionary format=’tabulate’: as_str is ignored
gui_apps

A list of GUI apps installed by this plugin

home_url
install(**opts)[source]

Call on pip to install the package if not yet installed

install_requirements
installed
load_setup_info(info_url)[source]

Load setup kwargs from the link in the registry

package_name

The name used to import the package

tags
test_installed()[source]

Return wether the plugin is installed

First, this checks wether the package_name can be imported. If not, we know that at least no new style plugin with that name is installed.

Secondly, tests wether all the entry points are currently found by the plugin loader. If not, it is considered not installed.

potential failures:
  • loading of the entry points is not tested
  • not properly uninstalled plugins might show up as
    installed if the entry points are still around.
  • it does not distinguish between not installed and
    an old version is installed
version

The version of the plugin package

aiida.plugins.entry_point.load_entry_point(group, name)[source]

Load the class registered under the entry point for a given name and group

Parameters:
  • group – the entry point group
  • name – the name of the entry point
Returns:

class registered at the given entry point

Raises:
aiida.plugins.entry_point.load_entry_point_from_string(entry_point_string)[source]

Load the class registered for a given entry point string that determines group and name

Parameters:

entry_point_string – the entry point string

Returns:

class registered at the given entry point

Raises:

Definition of factories to load classes from the various plugin groups.

aiida.plugins.factories.BaseFactory(group, name)[source]

Return the plugin class registered under a given entry point group and name.

Parameters:
  • group – entry point group
  • name – entry point name
Returns:

the plugin class

Raises:
aiida.plugins.factories.CalculationFactory(entry_point)[source]

Return the CalcJob sub class registered under the given entry point.

Parameters:entry_point – the entry point name
Returns:sub class of CalcJob
aiida.plugins.factories.DataFactory(entry_point)[source]

Return the Data sub class registered under the given entry point.

Parameters:entry_point – the entry point name
Returns:sub class of Data
aiida.plugins.factories.DbImporterFactory(entry_point)[source]

Return the DbImporter sub class registered under the given entry point.

Parameters:entry_point – the entry point name
Returns:sub class of DbImporter
aiida.plugins.factories.OrbitalFactory(entry_point)[source]

Return the Orbital sub class registered under the given entry point.

Parameters:entry_point – the entry point name
Returns:sub class of Orbital
aiida.plugins.factories.ParserFactory(entry_point)[source]

Return the Parser sub class registered under the given entry point.

Parameters:entry_point – the entry point name
Returns:sub class of Parser
aiida.plugins.factories.SchedulerFactory(entry_point)[source]

Return the Scheduler sub class registered under the given entry point.

Parameters:entry_point – the entry point name
Returns:sub class of Scheduler
aiida.plugins.factories.TransportFactory(entry_point)[source]

Return the Transport sub class registered under the given entry point.

Parameters:entry_point – the entry point name
Returns:sub class of Transport
aiida.plugins.factories.WorkflowFactory(entry_point)[source]

Return the WorkChain sub class registered under the given entry point.

Parameters:entry_point – the entry point name
Returns:sub class of WorkChain

Utilities for high-level querying of available plugins.

These tools read information from the cached registry. The plugin registry (in cache) is expected to be a dict where the keys are base entry point names of plugins (unique for registered plugins)

example registry:

registry = {
    'quantumespresso': {
        'name': 'aiida-quantumespresso',
        'package_name': 'aiida_quantumespresso',
        'pip_url': 'git+https://...',
        'other_key': 'other_value'
    }
    'vasp': {
        'name': aiida-vasp',
        'package_name': 'aiida_vasp',
        '...': '...'
    }
}
aiida.plugins.info.entry_point_from_tpstr(typestring)[source]
aiida.plugins.info.find_by_name(plugin_key)[source]

returns the pickled RegistryEntry object for a given plugin_key

aiida.plugins.info.find_by_pattern(pattern, ranking=False)[source]

returns a list of RegistryEntry objects for all matches

aiida.plugins.info.find_for_typestring(typestring)[source]

find the plugin with the base entry point name of the given typestring

Returns:dict with plugin keys if found, None if not found
aiida.plugins.info.plugin_ep_iterator()[source]

return an iterator over the plugin entrypoint base strings

Utilities for low-level querying of plugins.

Interface for operations that have to connect the registry online and that operate on the cache folder.

aiida.plugins.registry.cleanup_info(registry=None)[source]

delete any plugin info files that do not correspond to a registry entry

aiida.plugins.registry.load_cached()[source]

load the registry from the local cache if the local cache is not readable, create or update it

aiida.plugins.registry.load_online(errorhandler=None)[source]

loads the registry file and returns the list of plugins

aiida.plugins.registry.registry_cache_exists()[source]

check if the registry cache exists

Return bool:True if exists, False if not
aiida.plugins.registry.registry_cache_file_name()[source]

return the name of the registry cache file

aiida.plugins.registry.registry_cache_file_path()[source]

return the path to the cache file

aiida.plugins.registry.registry_cache_openable()[source]

return true if the registry cache file can be opened

aiida.plugins.registry.registry_file_url()[source]

return the url for the plugins.json file

aiida.plugins.registry.update(with_info=True, registry_err_handler=None, info_err_handler=None)[source]

Load the registry from its online location and pickle it.

Creates the cache file if necessary. By default updates the entry details cache for each entry as well.

Parameters:
  • with_info – default: True, update info cache for each entry as well
  • registry_err_handler – callable(exception) -> dict. Must either raise or return a registry dict
  • info_err_handler – callable(exception, plugin, data) -> None. Can raise or just print an error / warning.

If none of the error handlers are given, the function will stop execution if any broken links are encountered.

aiida.plugins.registry.update_info(registry=None, errorhandler=None)[source]

iterate through plugins, download setup info and return as dict

Utilities dealing with plugins and entry points.

class aiida.plugins.utils.PluginVersionProvider[source]

Bases: object

Utility class that determines version information about a given plugin resource.

__dict__ = mappingproxy({'__module__': 'aiida.plugins.utils', '__doc__': 'Utility class that determines version information about a given plugin resource.', '__init__': <function PluginVersionProvider.__init__>, 'logger': <property object>, 'get_version_info': <function PluginVersionProvider.get_version_info>, '__dict__': <attribute '__dict__' of 'PluginVersionProvider' objects>, '__weakref__': <attribute '__weakref__' of 'PluginVersionProvider' objects>})
__init__()[source]

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

__module__ = 'aiida.plugins.utils'
__weakref__

list of weak references to the object (if defined)

get_version_info(plugin)[source]

Get the version information for a given plugin.

Note

This container will keep a cache, so if this function was already called for the given plugin before for this instance, the result computer at last invocation will be returned.

Parameters:plugin – a class or function
Returns:dictionary with the version.core and optionally version.plugin if it could be determined.
logger