aiida.plugins#

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

Package Contents#

Classes#

PluginVersionProvider

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

Functions#

BaseFactory

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

CalcJobImporterFactory

Return the plugin registered under the given entry point.

CalculationFactory

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

DataFactory

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

DbImporterFactory

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

GroupFactory

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

OrbitalFactory

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

ParserFactory

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

SchedulerFactory

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

StorageFactory

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

TransportFactory

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

WorkflowFactory

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

get_entry_points

Return a list of all the entry points within a specific group

load_entry_point

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

load_entry_point_from_string

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

parse_entry_point

Return an entry point, given its group and spec (as formatted in the setup)

API#

aiida.plugins.BaseFactory(group: str, name: str, load: bool = True) Union[importlib_metadata.EntryPoint, Any]#

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

Parameters:
  • group – entry point group

  • name – entry point name

  • load – if True, load the matched entry point and return the loaded resource instead of the entry point itself.

Returns:

the plugin class

Raises:
aiida.plugins.CalcJobImporterFactory(entry_point_name: str, load: bool = True) Union[importlib_metadata.EntryPoint, Type[aiida.engine.CalcJobImporter]]#

Return the plugin registered under the given entry point.

Parameters:

entry_point_name – the entry point name.

Returns:

the loaded CalcJobImporter plugin.

Raises:

aiida.common.InvalidEntryPointTypeError – if the type of the loaded entry point is invalid.

aiida.plugins.CalculationFactory(entry_point_name: str, load: bool = True) Union[importlib_metadata.EntryPoint, Type[aiida.engine.CalcJob], Callable]#

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

Parameters:
  • entry_point_name – the entry point name.

  • load – if True, load the matched entry point and return the loaded resource instead of the entry point itself.

Returns:

sub class of CalcJob

Raises:

aiida.common.InvalidEntryPointTypeError – if the type of the loaded entry point is invalid.

aiida.plugins.DataFactory(entry_point_name: str, load: bool = True) Union[importlib_metadata.EntryPoint, Type[aiida.orm.Data]]#

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

Parameters:
  • entry_point_name – the entry point name.

  • load – if True, load the matched entry point and return the loaded resource instead of the entry point itself.

Returns:

sub class of Data

Raises:

aiida.common.InvalidEntryPointTypeError – if the type of the loaded entry point is invalid.

aiida.plugins.DbImporterFactory(entry_point_name: str, load: bool = True) Union[importlib_metadata.EntryPoint, Type[aiida.tools.dbimporters.DbImporter]]#

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

Parameters:
  • entry_point_name – the entry point name.

  • load – if True, load the matched entry point and return the loaded resource instead of the entry point itself.

Returns:

sub class of DbImporter

Raises:

aiida.common.InvalidEntryPointTypeError – if the type of the loaded entry point is invalid.

aiida.plugins.GroupFactory(entry_point_name: str, load: bool = True) Union[importlib_metadata.EntryPoint, Type[aiida.orm.Group]]#

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

Parameters:
  • entry_point_name – the entry point name.

  • load – if True, load the matched entry point and return the loaded resource instead of the entry point itself.

Returns:

sub class of Group

Raises:

aiida.common.InvalidEntryPointTypeError – if the type of the loaded entry point is invalid.

aiida.plugins.OrbitalFactory(entry_point_name: str, load: bool = True) Union[importlib_metadata.EntryPoint, Type[aiida.tools.data.orbital.Orbital]]#

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

Parameters:
  • entry_point_name – the entry point name.

  • load – if True, load the matched entry point and return the loaded resource instead of the entry point itself.

Returns:

sub class of Orbital

Raises:

aiida.common.InvalidEntryPointTypeError – if the type of the loaded entry point is invalid.

aiida.plugins.ParserFactory(entry_point_name: str, load: bool = True) Union[importlib_metadata.EntryPoint, Type[aiida.parsers.Parser]]#

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

Parameters:
  • entry_point_name – the entry point name.

  • load – if True, load the matched entry point and return the loaded resource instead of the entry point itself.

Returns:

sub class of Parser

Raises:

aiida.common.InvalidEntryPointTypeError – if the type of the loaded entry point is invalid.

class aiida.plugins.PluginVersionProvider#

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

Initialization

property logger: logging.Logger#
get_version_info(plugin: str | type) dict[Any, dict[Any, Any]]#

Get the version information for a given plugin.

Note

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

Parameters:

plugin – A class, function, or an entry point string. If the type is string, it will be assumed to be an entry point string and the class will attempt to load it first. It should be a full entry point string, including the entry point group.

Returns:

Dictionary with the version.core and optionally version.plugin if it could be determined.

Raises:
  • EntryPointError – If plugin is a string but could not be loaded as a valid entry point.

  • TypeError – If plugin (or the resource pointed to it in the case of an entry point) is not a class or a function.

aiida.plugins.SchedulerFactory(entry_point_name: str, load: bool = True) Union[importlib_metadata.EntryPoint, Type[aiida.schedulers.Scheduler]]#

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

Parameters:
  • entry_point_name – the entry point name.

  • load – if True, load the matched entry point and return the loaded resource instead of the entry point itself.

Returns:

sub class of Scheduler

Raises:

aiida.common.InvalidEntryPointTypeError – if the type of the loaded entry point is invalid.

aiida.plugins.StorageFactory(entry_point_name: str, load: bool = True) Union[importlib_metadata.EntryPoint, Type[aiida.orm.implementation.StorageBackend]]#

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

Parameters:
  • entry_point_name – the entry point name.

  • load – if True, load the matched entry point and return the loaded resource instead of the entry point itself.

Returns:

sub class of StorageBackend.

Raises:

aiida.common.InvalidEntryPointTypeError – if the type of the loaded entry point is invalid.

aiida.plugins.TransportFactory(entry_point_name: str, load: bool = True) Union[importlib_metadata.EntryPoint, Type[aiida.transports.Transport]]#

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

Parameters:
  • entry_point_name – the entry point name.

  • load – if True, load the matched entry point and return the loaded resource instead of the entry point itself.

Raises:

aiida.common.InvalidEntryPointTypeError – if the type of the loaded entry point is invalid.

aiida.plugins.WorkflowFactory(entry_point_name: str, load: bool = True) Union[importlib_metadata.EntryPoint, Type[aiida.engine.WorkChain], Callable]#

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

Parameters:
  • entry_point_name – the entry point name.

  • load – if True, load the matched entry point and return the loaded resource instead of the entry point itself.

Returns:

sub class of WorkChain or a workfunction

Raises:

aiida.common.InvalidEntryPointTypeError – if the type of the loaded entry point is invalid.

aiida.plugins.get_entry_points(group: str) importlib_metadata.EntryPoints#

Return a list of all the entry points within a specific group

Parameters:

group – the entry point group

Returns:

a list of entry points

aiida.plugins.load_entry_point(group: str, name: str) Any#

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: str) Any#

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.parse_entry_point(group: str, spec: str) importlib_metadata.EntryPoint#

Return an entry point, given its group and spec (as formatted in the setup)