octo Package — Octo 0.2 documentation

### Navigation

- index
- modules |
- Octo 0.2 documentation »

# octo Package

## `octo` Package

A plugin framework which allows you to write your application as a collection of (optionally interconnected) plugins.

## `exceptions` Module

exception `octo.exceptions.` `AlreadyStartedError`

  Bases: `octo.exceptions.OctoException`

  Raised when trying to call octo.start more than once

exception `octo.exceptions.` `NoSuchPluginError`

  Bases: `octo.exceptions.OctoException`

  Raised when an action is to be performed on a plugin that cannot be found

exception `octo.exceptions.` `NotStartedError`

  Bases: `octo.exceptions.OctoException`

  Raised when trying to call octo.stop before octo.start

exception `octo.exceptions.` `OctoException`

  Bases: `builtins.Exception`

## `manager` Module

class `octo.manager.` `Manager`(plugin_dirs=[])

  Bases: `builtins.object`

  This is the main `octo` application class.

  Normally, you would call octo.main instead of creating an instance of this class directly, as octo.main will make it available globally as octo.instance so plugins may interact with it.

  `activate_plugin`(plugin_name)

    Activate the given plugin

    plugin_name should be the name of the plugin to be activated.

  `call`(plugin_name, func, args=[], kwargs={})

    Call the given function on the given plugin object (specifed by plugin name)

  `call_many`(func, args=[], kwargs={})

    Call the given function on all active plugins and return results as a dictionary

    The returned dictionary will have the form of {‘plugin name’: <function_result>}

  `deactivate_plugin`(plugin_name)

    Deactivate the given plugin

    plugin_name should be the name of the plugin to be deactivated.

  `get_plugins`(include_inactive=False)

    Return a dictionary of loaded plugins

    Keys will consist of plugin names, with their values being the plugin instances (yapsy.PluginInfo.PluginInfo objects).

    When `include_inactive` is True, all collected plugins will be returned, otherwise only the activated plugins will be returned.

  `start`()

    Start and activate collected plugins

    A plugin will be activated when it has a config item ‘Enable’ under the section ‘Config’ with a value of True

  `stop`()

    Stop and deactivate loaded plugins

`octo.manager.` `exit_handler`(signal, frame)

  Called by run upon receiving SIGINT

`octo.manager.` `run`(plugin_dirs=[], block=False)

  Runs the `octo` application.

  Calling this function will initialize the Manager class and make it available as octo.instance so that plugins may import and interact with it.

  If block=True, this function will block until a SIGINT is received, either by the user hitting Ctrl+C or another process sending a SIGINT signal. If block=False then applications must ensure to call stop() appropriately themselves.

`octo.manager.` `stop`()

  Stops the `octo` application.

  Calling this function will stop and cleanup octo.instance

## `plugin` Module

class `octo.plugin.` `OctoPlugin`

  Bases: `yapsy.IPlugin.IPlugin`

  `activate`()

    Run plugin initialization code.

    Do not override this method in plugins. Instead, override the on_activation method instead.

  `deactivate`()

    Run plugin de-initialization code.

    Do not override this method in plugins. Instead, override the on_deactivation method instead.

  `on_activation`()

    Override this method to run code on plugin activation.

    This method may be safely overridden without calling Super.

  `on_deactivation`()

    Override this method to run code on plugin deactivation.

    This method may be safely overridden without calling Super.

### Navigation

- index
- modules |
- Octo 0.2 documentation »