oso.framework.plugin package

Subpackages

Submodules

oso.framework.plugin.base module

PluginProtocol class for defining plugins.

class oso.framework.plugin.base.PluginProtocol(*args, **kwargs)[source]

Bases: Protocol

PluginProtocol Constructor.

Config:

Any BaseModel extended class can be utilized to add environment variables after registering with the config_manager.

internalViews

Any internal API endpoints that the ISV wishes to expose to any peer containers. These endpoints are prepended with /internal/.

Type:

collections.abc.Mapping[str, flask.views.View]

externalViews

Any external API endpoints that the ISV wishes to expose to users outside the container. These endpoints are prepended with /api/isv/.

Type:

collections.abc.Mapping[str, flask.views.View]

status() ComponentStatus[source]

Return the status of the component.

Returns:

Mode dependent component’s

Return type:

oso.framework.data.types.ComponentStatus

Raises:

werkzeug.exceptions.HTTPException – Any HTTP response other than 200 should return a subclass.

to_isv(oso: DocumentList) Any[source]

Convert OSO formatted document list to ISV data.

Parameters:

(oso.framework.data.types.DocumentList) (oso) – OSO formatted document list.

Returns:

ISV formatted document list.

Return type:

Any

Raises:

werkzeug.exceptions.HTTPException – Any HTTP response other than 200 should return a subclass.

to_oso(isv: Any = None) DocumentList[source]

Convert ISV data to OSO formatted document list.

Returns:

OSO formatted document list.

Return type:

oso.framework.data.types.DocumentList

Raises:

werkzeug.exceptions.HTTPException – Any HTTP response other than 200 should return a subclass.

oso.framework.plugin.extension module

PluginExtension class for initializing and configuring plugins.

class oso.framework.plugin.extension.PluginConfig(*, addons: ~collections.abc.Sequence[~oso.framework.plugin.addons.main.BaseAddonConfig] = <factory>, mode: ~typing.Literal['frontend', 'backend'], application: ~pydantic.types.ImportString)[source]

Bases: AutoLoadConfig, _addons

Configuration model for plugins.

mode(Literal["frontend", "backend"])
Type:

The mode of the plugin.

application(ImportString)
Type:

The application class or string.

class oso.framework.plugin.extension.PluginExtension(config: PluginConfig)[source]

Bases: object

The PluginExtension class initializes and configures plugins in the OSO framework.

KEY(ClassVar[Literal["oso-plugin"]])
Type:

The key for the plugin extension.

config(PluginConfig)
Type:

The configuration for the plugin.

init_app(app: Flask) None[source]

Initialize the plugin with the Flask application.

Parameters:

app (Flask) – The Flask application instance.

Raises:

StartupException: – If the plugin doesn’t follow the PluginProtocol or isn’t initialized.

oso.framework.plugin.extension.current_oso_plugin() PluginExtension[source]

Return the current OSO plugin extension instance.

Returns:

PluginExtension

Return type:

The current plugin extension instance.

oso.framework.plugin.extension.current_oso_plugin_app() PluginProtocol[source]

Return the current plugin instance.

Returns:

PluginProtocol

Return type:

The current plugin instance.

oso.framework.plugin.extension.current_oso_plugin_config() BaseModel[source]

Return the current plugin configuration.

Returns:

BaseModel

Return type:

The current plugin configuration.

Module contents

Plugin entrypoint.

Plugin Application should implement .base.PluginProtocol.

class oso.framework.plugin.PluginProtocol(*args, **kwargs)[source]

Bases: Protocol

PluginProtocol Constructor.

Config:

Any BaseModel extended class can be utilized to add environment variables after registering with the config_manager.

internalViews

Any internal API endpoints that the ISV wishes to expose to any peer containers. These endpoints are prepended with /internal/.

Type:

collections.abc.Mapping[str, flask.views.View]

externalViews

Any external API endpoints that the ISV wishes to expose to users outside the container. These endpoints are prepended with /api/isv/.

Type:

collections.abc.Mapping[str, flask.views.View]

status() ComponentStatus[source]

Return the status of the component.

Returns:

Mode dependent component’s

Return type:

oso.framework.data.types.ComponentStatus

Raises:

werkzeug.exceptions.HTTPException – Any HTTP response other than 200 should return a subclass.

to_isv(oso: DocumentList) Any[source]

Convert OSO formatted document list to ISV data.

Parameters:

(oso.framework.data.types.DocumentList) (oso) – OSO formatted document list.

Returns:

ISV formatted document list.

Return type:

Any

Raises:

werkzeug.exceptions.HTTPException – Any HTTP response other than 200 should return a subclass.

to_oso(isv: Any = None) DocumentList[source]

Convert ISV data to OSO formatted document list.

Returns:

OSO formatted document list.

Return type:

oso.framework.data.types.DocumentList

Raises:

werkzeug.exceptions.HTTPException – Any HTTP response other than 200 should return a subclass.

oso.framework.plugin.create_app() Flask[source]

Create and return the WSGI application for Gunicorn to use.

ConfigManager and LoggingFactory should be ready to use before entry.

oso.framework.plugin.current_oso_plugin() PluginExtension[source]

Return the current OSO plugin extension instance.

Returns:

PluginExtension

Return type:

The current plugin extension instance.

oso.framework.plugin.current_oso_plugin_app() PluginProtocol[source]

Return the current plugin instance.

Returns:

PluginProtocol

Return type:

The current plugin instance.