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.AccessLogAccess log of the requests, in the combined format or in JSON.
Pyjoyment.Plugin.AllowedHostsValidation of
HostandOriginagainst DNS rebinding.Pyjoyment.Plugin.ConfigPython-ish configuration files.
Pyjoyment.Plugin.DefaultHelpersGeneral purpose helper collection, loaded automatically.
Pyjoyment.Plugin.EPLRendererRenderer for plain embedded Python templates, loaded automatically.
Pyjoyment.Plugin.EPRendererRenderer for more sophisticated embedded Python templates, loaded automatically.
Pyjoyment.Plugin.HealthLiveness and readiness of containers and orchestrators.
Pyjoyment.Plugin.HeaderConditionRoute condition for all kinds of headers, loaded automatically.
Pyjoyment.Plugin.INIConfigINI configuration files.
Pyjoyment.Plugin.JSONConfigJSON configuration files.
Pyjoyment.Plugin.MountMount whole
Pyjoymentapplications.Pyjoyment.Plugin.PyRendererRenderer for template strings, loaded automatically.
Pyjoyment.Plugin.TagHelpersTemplate specific helper collection, loaded automatically.
Pyjoyment.Plugin.TOMLConfigTOML configuration files.
Pyjoyment.Plugin.YAMLConfigYAML 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.Pluginsinherits all methods fromPyjo.EventEmitterand 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.