idmtools.registry.utils module

idmtools.registry.utils.is_a_plugin_of_type(value, plugin_specification: Type[idmtools.registry.plugin_specification.PluginSpecification]) → bool

Determine if a value of a plugin specification is of type PluginSpecification.

Parameters
  • value – The value to inspect.

  • plugin_specification – Plugin specification to check against.

Returns

A Boolean indicating True if the plugin is of a subclass of PluginSpecification, else False.

idmtools.registry.utils.load_plugin_map(entrypoint: str, spec_type: Type[idmtools.registry.plugin_specification.PluginSpecification], strip_all: bool = True) → Dict[str, Type[idmtools.registry.plugin_specification.PluginSpecification]]

Load plugins from entry point with the indicated type of specification into a map.

Warning

This could cause name collisions if plugins of the same name are installed.

Parameters
  • entrypoint – The name of the entry point.

  • spec_type – The type of plugin specification.

  • strip_all – Pass through for get_name from Plugins. Changes names in plugin registries

Returns

Returns a dictionary of name and PluginSpecification.

Return type

(Dict[str, Type[PluginSpecification]])

idmtools.registry.utils.plugins_loader(entry_points_name: str, plugin_specification: Type[idmtools.registry.plugin_specification.PluginSpecification]) → Set[idmtools.registry.plugin_specification.PluginSpecification]

Loads all the plugins of type PluginSpecification from entry point name. idmtools also supports loading plugins through a list of strings representing the paths to modules containing plugins.

Parameters
  • entry_points_name – Entry point name for plugins.

  • plugin_specification – Plugin specification to load.

Returns

All the plugins of the type indicated.

Return type

(Set[PluginSpecification])

idmtools.registry.utils.discover_plugins_from(library: Any, plugin_specification: Type[idmtools.registry.plugin_specification.PluginSpecification]) → List[Type[idmtools.registry.plugin_specification.PluginSpecification]]

Search a library object for plugins of type PluginSpecification.

Currently it detects module and classes. In the future support for strings will be added.

Parameters
  • library – Library object to discover plugins from.

  • plugin_specification – Specification to search for.

Returns

List of plugins.

Return type

List[Type[PluginSpecification]]