cement.core.plugin

Cement core plugins module.

class cement.core.plugin.CementPluginHandler(*args, **kw)

Bases: cement.core.handler.CementBaseHandler

Base class that all Plugin Handlers should sub-class from.

class Meta

Bases: object

Handler meta-data (can be passed as keyword arguments to the parent class).

interface

The interface that this class implements.

alias of IPlugin

label = None

The string identifier of this handler.

class cement.core.plugin.IPlugin

Bases: cement.core.interface.Interface

This class defines the Plugin Handler Interface. Classes that implement this handler must provide the methods and attributes defined below.

Implementations do not subclass from interfaces.

Usage:

from cement.core import plugin

class MyPluginHandler(object):
    class Meta:
        interface = plugin.IPlugin
        label = 'my_plugin_handler'
    ...
_setup(app_obj)

The _setup function is called during application initialization and must ‘setup’ the handler object making it ready for the framework or the application to make further calls to it.

Parameters:app_obj – The application object.
get_disabled_plugins()

Returns a list of plugins that are disabled in the config.

get_enabled_plugins()

Returns a list of plugins that are enabled in the config.

get_loaded_plugins()

Returns a list of plugins that have been loaded.

load_plugin(plugin_name)

Load a plugin whose name is ‘plugin_name’.

Parameters:plugin_name – The name of the plugin to load.
load_plugins(plugin_list)

Load all plugins from plugin_list.

Parameters:plugin_list – A list of plugin names to load.
cement.core.plugin.plugin_validator(klass, obj)

Validates an handler implementation against the IPlugin interface.