Plugin Management

FlaskBB provides a couple of helpers for helping with plugin management.

Plugin Registry

The plugin registry holds all available plugins. It shows the plugin’s status whether it is enabled or disabled, installable or installed. The registry also holds a reference to the plugin’s instance, provides an interface to access the plugins metadata and stores its settings.

You can query it like any SQLAlchemy Model:

plugin = PluginRegistry.query.filter_by(name="portal").first()
class flaskbb.plugins.models.PluginRegistry(**kwargs)[source]

Returns a dict with contains all the settings in a plugin.


Returns some information about the plugin.


Returns True if the plugin has settings that can be installed.


Returns True if the plugin is installed.


Generates a settings form based on the settings.


Updates the given settings of the plugin.

Parameters:settings – A dictionary containing setting items.
add_settings(settings, force=False)[source]

Adds the given settings to the plugin.

  • settings – A dictionary containing setting items.
  • force – Forcefully overwrite existing settings.

Plugin Manager

FlaskBB overrides the PluginManager from pluggy to provide some additional functionality like accessing the information stored in a file. The plugin manager will only list the currently enabled plugins and can be used to directly access the plugins instance by its name.

Accessing a plugins instance is as easy as:

plugin_instance = current_app.pluggy.get_plugin(name)
class flaskbb.plugins.manager.FlaskBBPluginManager(project_name)[source]

Overwrites pluggy.PluginManager to add FlaskBB specific stuff.

register(plugin, name=None, internal=False)[source]

Register a plugin and return its canonical name or None if the name is blocked from registering. Raise a ValueError if the plugin is already registered.

unregister(plugin=None, name=None)[source]

Unregister a plugin object and all its contained hook implementations from internal data structures.


Block registrations of the given name, unregister if already registered.


Return True if the name blockss registering plugins of that name.


Return a plugin or None for the given name.


Return name for registered plugin or None if not registered.


Load modules from querying the specified setuptools entrypoint name. Return the number of loaded plugins.


Returns the metadata for a given name.


Returns only the enabled plugin names.


Returns a list of internal name/plugin pairs.


Returns the metadata for all plugins


Returns a name/distinfo tuple pairs of disabled plugins.


Returns a list with disabled plugins.


Returns a set of registered internal plugins.


Returns a set of registered external plugins.

add_hookcall_monitoring(before, after)

add before/after tracing functions for all hooks and return an undo function which, when called, will remove the added tracers.

before(hook_name, hook_impls, kwargs) will be called ahead of all hook calls and receive a hookcaller instance, a list of HookImpl instances and the keyword arguments for the hook call.

after(outcome, hook_name, hook_impls, kwargs) receives the same arguments as before but also a pluggy._callers._Result object which represents the result of the overall hook call.


add new hook specifications defined in the given module_or_class. Functions are recognized if they have been decorated accordingly.


Verify that all hooks which have not been verified against a hook specification are optional, otherwise raise PluginValidationError.


enable tracing of hook calls and return an undo function.


Return canonical name for a plugin object. Note that a plugin may be registered under a different name which was specified by the caller of register(plugin, name). To obtain the name of an registered plugin use get_name(plugin) instead.


get all hook callers for the specified plugin.


return the set of registered plugins.


Return True if a plugin with the given name is registered.


Return True if the plugin is already registered.


return list of name/plugin pairs.


return list of distinfo/plugin tuples for all setuptools registered plugins.

subset_hook_caller(name, remove_plugins)

Return a new _hooks._HookCaller instance for the named method which manages calls to all registered plugins except the ones from remove_plugins.