How to use the pluginbase._PluginSourceModule 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
identifier = str(uuid.uuid4())
        #: the identifier for this source.
        self.identifier = identifier
        #: A reference to the plugin base that created this source.
        self.base = base
        #: a list of paths where plugins are searched in.
        self.searchpath = searchpath
        #: The internal module name of the plugin source as it appears
        #: in the :mod:`pluginsource._internalspace`.
        self.spaceid = '_sp' + hashlib.md5(
            _to_bytes(self.base.package) + b'|' +
            _to_bytes(identifier),
        ).hexdigest()
        #: a reference to the module on the internal
        #: :mod:`pluginsource._internalspace`.
        self.mod = _PluginSourceModule(self)

        if hasattr(_internalspace, self.spaceid):
            raise RuntimeError('This plugin source already exists.')
        sys.modules[self.mod.__name__] = self.mod
        setattr(_internalspace, self.spaceid, self.mod)

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