[Python-ideas] registery system in Python ?

Tarek Ziadé ziade.tarek at gmail.com
Tue Apr 7 20:05:51 CEST 2009


Hello

I am working on a plugin system for Distutils, inspired from what
setuptools provides (entry_points)
so I am trying to describe how a generic registery could work.

But, as discussed with some people at Pycon, this is a general need.
What about adding a simple generic registery system in Python stdlib ?

The APIs I was thinking about would register plugins under group names
for an easy classification:

- get_plugin(group, name) : returns an object for (group, name)
- register_plugin(group, name, object): register an object, for (group, name)
- unregister_plugin(group, name): removes an object for (group, name)
- list_plugins(group=None, doc=False): returns a list of all objects
for the given group.
- list_groups(): return a list of all groups

having groups make it simpler to classify plugins. In my use case,
group could be : 'distutils:filelist'
to list all plugins that knows how to build a file list. (see
http://wiki.python.org/moin/Distutils/ManifestPluginSystem)

Regards
Tarek

-- 
Tarek Ziadé | Association AfPy | www.afpy.org
Blog FR | http://programmation-python.org
Blog EN | http://tarekziade.wordpress.com/



More information about the Python-ideas mailing list