[Python-ideas] registery system in Python ?

Sebastien Binet seb.binet at gmail.com
Thu Apr 23 20:31:30 CEST 2009


> 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)

sounds nice but what about 'discovering' new plugins ?
writting a plugin system in python isn't super hard (it is merely a glorified 
API around a dict plus some bells and whistles,) the discovering part is a bit 
more nagging though:
 - populate a "well known" (set of) directory
 - naming conventions: all files *_plugin.{ini,py} are implicit plugins 
registration files
 - ?

or is the underlying idea to write a 'filelist' plugin which will discover new 
plugins ?


More information about the Python-ideas mailing list