new new plugin architecture suggestion
Posted: Sat Jun 30, 2007 5:20 pm
Hi I have been playing around with the plugin arch and I'll like to propose an enhancement, please note this is based on having setuptools manage the plugins, although that only counts for discoverability and metadata so those places could be replaced.
currently you need to supply 3 groups of information
1. module level package info (plugin_name,autho,etc.)
2. module level package functions (deluge_init, enable)
3. object level plugin control (unload,update)
I want to reorganize this information in hooks
on_install
on_uninstall
on_create
on_update
on_unload
on_configure
and so on.
after that you will have a Plugin class which will probably be instantiated in on_create and be keep as a module variable for unload/configure,etc. What I like about this is that your plugin code is totally independent of the API, for example on_create will pass in the core and the interface but if you have a plugin that doesn't make use of the interface just ignore it when creating ur plugin instance.
also all the metadata will be read from the egg-info dir since this is a python package
currently you need to supply 3 groups of information
1. module level package info (plugin_name,autho,etc.)
2. module level package functions (deluge_init, enable)
3. object level plugin control (unload,update)
I want to reorganize this information in hooks
on_install
on_uninstall
on_create
on_update
on_unload
on_configure
and so on.
after that you will have a Plugin class which will probably be instantiated in on_create and be keep as a module variable for unload/configure,etc. What I like about this is that your plugin code is totally independent of the API, for example on_create will pass in the core and the interface but if you have a plugin that doesn't make use of the interface just ignore it when creating ur plugin instance.
also all the metadata will be read from the egg-info dir since this is a python package