plugincode

raw JSON →
32.0.0 verified Fri May 01 auth: no python

plugincode is a Python library providing plugin functionality for the ScanCode toolkit. It defines a plugin system with hooks, data-driven processing, and a registry for plugins. Current version 32.0.0, released June 2023. Release cadence is irregular, with major version bumps.

pip install plugincode
error ModuleNotFoundError: No module named 'plugincode'
cause plugincode not installed.
fix
Run: pip install plugincode
error AttributeError: module 'plugincode' has no attribute 'PluginManager'
cause Outdated version (<30.0.0) where PluginManager was not exposed at top level.
fix
Upgrade to latest version: pip install --upgrade plugincode
breaking Python 3.6 support dropped in v31.0.0
fix Upgrade to Python 3.7 or later.
deprecated Calver versioning dropped in v30.0.0; now uses semver.
fix Use semantic versioning for dependency specs (e.g., plugincode>=30.0.0).
gotcha PluginManager is a singleton; direct instantiation may lead to multiple instances.
fix Use the pre-initialized `plugin_manager` instance from `plugincode` module instead of creating a new PluginManager().

Basic usage: iterate over registered plugins or filter by hook.

from plugincode import plugin_manager

# Get all registered plugins
for plugin in plugin_manager.get_plugins():
    print(plugin)

# Or get plugins by hook name
for plugin in plugin_manager.get_plugins_by_hook('pre_scan'):
    print(plugin.name)