octo Package

octo Package

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

cli Module

octo.cli.main()[source]

Main entry point for octo CLI script.

Normally, setuptools packaging will create a script which uses this function as it’s entry point. (See entry_points in setup.py).

exceptions Module

exception octo.exceptions.AlreadyStartedError[source]

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[source]

Bases: octo.exceptions.OctoException

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

exception octo.exceptions.OctoException[source]

Bases: builtins.Exception

manager Module

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

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)[source]

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)[source]

Deactivate the given plugin

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

get_plugins(include_inactive=False)[source]

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()[source]

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()[source]

Stop and deactivate loaded plugins

octo.manager.exit_handler(signal, frame)[source]

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()[source]

Stops the octo application.

Calling this function will stop and cleanup octo.instance

plugin Module

class octo.plugin.OctoPlugin[source]

Bases: yapsy.IPlugin.IPlugin

activate()[source]

Run plugin initialization code.

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

deactivate()[source]

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.

Table Of Contents

Previous topic

octo

This Page