How to use the pluginbase.PluginSource function in pluginbase

To help you get started, we’ve selected a few pluginbase examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mitsuhiko / pluginbase / pluginbase.py View on Github external
def make_plugin_source(self, *args, **kwargs):
        """Creates a plugin source for this plugin base and returns it.
        All parameters are forwarded to :class:`PluginSource`.
        """
        return PluginSource(self, *args, **kwargs)
github milvus-io / milvus / shards / utils / pluginextension.py View on Github external
import importlib.util
from pluginbase import PluginBase, PluginSource


class MiPluginSource(PluginSource):
    def load_plugin(self, name):
        plugin = super().load_plugin(name)
        spec = importlib.util.spec_from_file_location(self.base.package + '.' + name, plugin.__file__)
        plugin = importlib.util.module_from_spec(spec)
        spec.loader.exec_module(plugin)
        return plugin


class MiPluginBase(PluginBase):
    def make_plugin_source(self, *args, **kwargs):
        return MiPluginSource(self, *args, **kwargs)

pluginbase

PluginBase is a module for Python that enables the development of flexible plugin systems in Python.

BSD-2-Clause
Latest version published 4 years ago

Package Health Score

58 / 100
Full package analysis