Pyjoyment.Plugins - Plugin manager

from Pyjoyment.Plugins import Plugins

plugins = Plugins()
plugins.namespaces.append('MyApp.Plugin')

# Or import the module, as in Google Python Style Guide

import Pyjoyment.Plugins

plugins = Pyjoyment.Plugins.new()
plugins.namespaces.append('MyApp.Plugin')

Pyjoyment.Plugins is the plugin manager of Pyjoyment.

Plugins

The following plugins are included in the Pyjoyment distribution as examples.

Pyjoyment.Plugin.AccessLog

Access log of the requests, in the combined format or in JSON.

Pyjoyment.Plugin.AllowedHosts

Validation of Host and Origin against DNS rebinding.

Pyjoyment.Plugin.Config

Python-ish configuration files.

Pyjoyment.Plugin.DefaultHelpers

General purpose helper collection, loaded automatically.

Pyjoyment.Plugin.EPLRenderer

Renderer for plain embedded Python templates, loaded automatically.

Pyjoyment.Plugin.EPRenderer

Renderer for more sophisticated embedded Python templates, loaded automatically.

Pyjoyment.Plugin.Health

Liveness and readiness of containers and orchestrators.

Pyjoyment.Plugin.HeaderCondition

Route condition for all kinds of headers, loaded automatically.

Pyjoyment.Plugin.INIConfig

INI configuration files.

Pyjoyment.Plugin.JSONConfig

JSON configuration files.

Pyjoyment.Plugin.Mount

Mount whole Pyjoyment applications.

Pyjoyment.Plugin.PyRenderer

Renderer for template strings, loaded automatically.

Pyjoyment.Plugin.TagHelpers

Template specific helper collection, loaded automatically.

Pyjoyment.Plugin.TOMLConfig

TOML configuration files.

Pyjoyment.Plugin.YAMLConfig

YAML configuration files.

Events

Pyjoyment.Plugins inherits all events from Pyjo.EventEmitter.

See also

Pyjoyment, https://mojolicious.org.

Ported from Mojolicious::Plugins of Mojolicious 9.49.

class Pyjoyment.Plugins.Pyjoyment_Plugins[source]

Pyjoyment.Plugins inherits all methods from Pyjo.EventEmitter and implements the following new ones.

emit_chain(name: str, *args: Any) → Any[source]
plugins.emit_chain('foo')
plugins.emit_chain('foo', 123)

Emit events as chained hooks.

emit_hook(name: str, *args: Any) → Self[source]
plugins = plugins.emit_hook('foo')
plugins = plugins.emit_hook('foo', 123)

Emit events as hooks.

emit_hook_reverse(name: str, *args: Any) → Self[source]
plugins = plugins.emit_hook_reverse('foo')
plugins = plugins.emit_hook_reverse('foo', 123)

Emit events as hooks in reverse order.

load_plugin(name: str) → Pyjoyment_Plugin[source]
plugin = plugins.load_plugin('some_thing')
plugin = plugins.load_plugin('SomeThing')
plugin = plugins.load_plugin('MyApp.Plugin.SomeThing')

Load a plugin from the configured namespaces or by full module name.

namespaces
namespaces = plugins.namespaces
plugins.namespaces = ['Pyjoyment.Plugin']

Namespaces to load plugins from, defaults to Pyjoyment.Plugin.

# Add another namespace to load plugins from
plugins.namespaces.append('MyApp.Plugin')
register_plugin(name: str, app: Pyjoyment_App, conf: dict[str, Any] | None = None, /, **values: Any) → Any[source]
plugins.register_plugin('some_thing', Pyjoyment.new())
plugins.register_plugin('some_thing', Pyjoyment.new(), foo=23)
plugins.register_plugin('some_thing', Pyjoyment.new(), {'foo': 23})
plugins.register_plugin('SomeThing', Pyjoyment.new())
plugins.register_plugin('SomeThing', Pyjoyment.new(), foo=23)
plugins.register_plugin('SomeThing', Pyjoyment.new(), {'foo': 23})
plugins.register_plugin('MyApp.Plugin.SomeThing', Pyjoyment.new())
plugins.register_plugin('MyApp.Plugin.SomeThing', Pyjoyment.new(), foo=23)
plugins.register_plugin('MyApp.Plugin.SomeThing', Pyjoyment.new(), {'foo': 23})

Load a plugin from the configured namespaces or by full module name and run register, optional arguments are passed through.