[ckan-discuss] Thoughts on a plugin system
Rufus Pollock
rufus.pollock at okfn.org
Sun Jul 11 02:22:55 BST 2010
Going forward we probably want some kind of plugin system in ckan to
provide for easy extensibility. I've started a collaborative pad for
working on this here:
<http://ckan.okfnpad.org/plugins>
Excerpted below. Comments/suggestions/criticism etc *very* welcome --
either comment here or just edit the pad ...
Regards,
Rufus
= Introduction =
Creating a plugin system for CKAN is key to making CKAN (easily) extensible.
= Examples of Plugins =
1. Custom forms (with extra fields) for CKAN (we already have this)
1. Custom form widgets (e.g. geo field)
2. Theming (we already have this but this sort of a plugin)
3. Widgets e.g.
1. Visualizing/Previewing a package resouce (e.g. show sample rows
for a csv/gdocs spreadsheet) on the CKAN package page
2. Wikipedia like flags on pages based on tags
3. Sidebar customization (widgets)
4. External workers executing on package create/update etc (now in
place with new messaging framework). E.g.
* Calculate resource hashes
* On RDF resource/dataset update calculate attributes (number of
triples, type of triples etc)
* Validation of resource (is it a 404, is the mime-type it claims etc)
* Automated storage
= Requirements =
A plugin system must provide 3 things:
1. Plugin entry/extension points (hooks where plugins get
utilized/called from)
2. Plugin interface
3. Plugin manager (registry + dispatch)
* [ckan.plugin]: setuptools inversion of control for plugin registration
* List of plugins activated must be stored in config
* model entry points
* model_create(session)
* model_upgrade(session, version) method taking a session argument
* templates entry points
* template path (use pkgutil)
* templates directroy as plugin/{plugin-name}
* event hooks, integration points
* ckan has to expose a set of interfaces
* settings access
= Research =
0. http://stackoverflow.com/questions/932069/building-a-minimal-plugin-architecture-in-python
1. http://wehart.blogspot.com/2009/01/python-plugin-frameworks.html
2. Zope Component Architecture http://pypi.python.org/pypi/grokcore.component
3. Trac Component Architecture
http://trac.edgewall.org/wiki/TracDev/ComponentArchitecture
4. Envisage (enthough):
https://svn.enthought.com/enthought/wiki/EnvisageThree/core.html
5. http://pypi.python.org/pypi/pyutilib.component.core/
* Based on trac.core. Looks well-factored and very promising
6. https://bespin.mozillalabs.com/docs/pluginguide/index.html
* Javascript but useful
More information about the ckan-discuss
mailing list