pluginify.utils package#

Submodules#

pluginify.utils.context_managers module#

Module for handling optional dependencies throughout pluginify.

pluginify.utils.context_managers.import_optional_dependencies(loglevel='info')[source]#

Attempt to import a package and log the event if the import fails.

Parameters:

loglevel (str) – Name of the log level to write to. May be any valid log level (e.g. debug, info, etc.).

pluginify.utils.validators module#

Pluginify validators module.

Currently only implements a PluginRegistryValidator class.

class pluginify.utils.validators.PluginRegistryValidator(namespace, fpaths=None)[source]#

Bases: PluginRegistry

Subclass of PluginRegistry which adds functionality for unit testing.

validate_all_registries()[source]#

Validate all registries in the current installation.

This should be run during testing, but not at runtime. Ensure we do not fail catastrophically for a single bad plugin at runtime, so test up front to test validity.

validate_plugin_attrs(plugin_type, interface, name, plugin)[source]#

Test non-product plugin for all required attributes.

validate_plugin_types_exist(reg_dict, reg_path)[source]#

Test that all top level plugin types exist in each registry file.

validate_registry(current_registry, fpath)[source]#

Test all plugins found in registered plugins for their validity.

validate_registry_interfaces(current_registry)[source]#

Test Plugin Registry interfaces validity.

Module contents#

Pluginify utility module.

pluginify.utils.merge_nested_dicts(dest, src, in_place=True, replace=False)[source]#

Perform an in-place merge of src into dest.

Performs an in-place merge of src into dest while preserving any values that already exist in dest.

Parameters:
  • dest (dict) –

    • The destination dictionary to merge to

  • src (dict) –

    • The source dictionary to merge into dest

  • in_place (bool, default=True) –

    • Whether or not to merge directly into dest or to create a deepcopy of dest and return that as the final result. By default, this function will merge directly into dest.

  • replace (boo, default=False) –

    • Whether or not to override duplicate keys in src and dest with the contents of src. By default, replace is set to false and overriding will not occur.