plugin development best practices

Diez B. Roggisch deets at nospam.web.de
Thu Feb 22 10:13:54 EST 2007


Jean-Paul Calderone wrote:

> On Thu, 22 Feb 2007 15:36:42 +0100, "Diez B. Roggisch"
> <deets at nospam.web.de> wrote:
>>> Simple plugin system proposal:
>>>
>>> have a package (directory with __init__.py) called plugins where the
>>> actual plugins are modules in this directory.
>>>
>>> When the main script imports the plugins package, all plugin modules
>>> would be available as plugins.pluginA, plugins.pluginB , etc.
>>>
>>> A registry of available plugins would be available as a simple
>>> dir(plugins).
>>>
>>> code in the main script than wished to use a given plugin, would only
>>> have to look in the registry  before calling any code from a given
>>> plugin.
>>>
>>> What is wrong/missing with this simple framework?
>>
>>Nothing wrong.
> 
> Are you sure?

Darn. You're right of course - I just got the basic idea, and formed in my
mind the "get the modules filename, thus the path, glob over it for *py,
and thus get the subsequent module names"-pattern. Which is trivial of
course, but not as trivial as just dir(module)

Diez



More information about the Python-list mailing list