A plugin framework
Project description
yantra
yantra is a simple plugin manager/plugin discovery framework.
Usage
Let's assume you have a class called BaseReportPlugin which all report plugins derive from.
from yantra import PluginManager, PluginType
from reports import BaseReportPlugin
# Define the type
report_type = PluginType(name='report',
base_class=BaseReportPlugin',
path='/plugins/reports/')
# Instantiate the manager
plugin_manager = PluginManager([report_type])
# Fetch plugins
plugin_manager.get_plugins(report_type)
You can register multiple plugin types. An alternate way to register plugin types is as follows:
plugin_manager = PluginManager()
plugin_manager.register_plugin_type(foo_type)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
yantra-0.6.0.tar.gz
(3.5 kB
view hashes)
Built Distribution
yantra-0.6.0-py3-none-any.whl
(3.8 kB
view hashes)