Plugins

Plugins(conf) Manager for all plugins
manager.Plugin(plugin, app) A single plugin object
manager.PluginManager(name, loader) The base class for the plugin manager
manager.DriverManager(app, name, loader) A plugin manager for a single plugin
tools.PluginInfo Get info about a plugin
tools.Weather Get the weather from the weather driver
api.info Get the info of all the enabled plugins

Plugins

class blueweather.plugins.Plugins(conf: blueweather.config.Config)

Bases: object

Manager for all plugins

Parameters:conf – config
load()

Load the plugins

Manager

class blueweather.plugins.manager.Plugin(plugin: object, app: django.apps.config.AppConfig)

Bases: object

A single plugin object

Contains information about the plugin

Parameters:
  • plugin – plugin object
  • app – app the plugin belongs to
call(func: str, *args, **kwargs)

Call a function in the plugin

Parameters:func – function name to call
class blueweather.plugins.manager.PluginManager(name: str, loader: callable)

Bases: collections.abc.Sized, collections.abc.Iterable

The base class for the plugin manager

load()

Load the plugins

map(func: callable)

Map a function to all the plugins this manager manages

Parameters:func – function to call on each plugin
mapCall(func_name, *args, **kwargs)

Map a function to all the plugins this manager manages

Parameters:func_name – name of the function to call
class blueweather.plugins.manager.DriverManager(app: str, name: str, loader: callable)

Bases: blueweather.plugins.manager.PluginManager

A plugin manager for a single plugin

Parameters:
  • app – app to load the plugin from
  • loader – loader
load()

Load the plugins

Tools

The DAO is the link between BlueWeather and the plugins.

class blueweather.plugins.tools.PluginInfo

Bases: object

Get info about a plugin

classmethod get_metadata(app: django.apps.config.AppConfig) → dict

Get the metadata for a plugin

Parameters:app – the app the plugin belongs to
Returns:metadata for the plugin
interface Metadata {
    packageName: string
    version?: string
    summary?: string
    homepage?: string
    author?: string
    email?: string
    license?: string
    description?: html
}
class blueweather.plugins.tools.Weather

Bases: object

Get the weather from the weather driver

static on_weather_request(man: blueweather.plugins.manager.DriverManager) → dict

request the weather from the weather driver

Parameters:plugin – driver
Returns:weather data

Utils

blueweather.plugins.utils.load_app_module(app: django.apps.config.AppConfig, module: str)

Load a module that belongs to an app

Parameters:
  • app – app to import from
  • module – module name
Returns:

found module or None

blueweather.plugins.utils.find_members(module) → List[Tuple[str, object]]

Find all the members of a module

Parameters:module – module
Returns:all public members of the module
blueweather.plugins.utils.get_app(name: str) → django.apps.config.AppConfig

Get an app from its name

Parameters:name – app name
Returns:AppConfig

API

Access the Plugin data from the ReST API.

Plugins api prefix: /api/plugins/

api.info(page: int = 0, size: int = 10)

Get the info of all the enabled plugins

Method:

any

Parameters:
  • page (int) – page number
  • size (int) – size of pages