plugin development best practices

Flavio fccoelho at gmail.com
Thu Feb 22 09:21:55 EST 2007


On Feb 22, 10:53 am, "Flavio" <fccoe... at gmail.com> wrote:
> Hi,
>
> Nowadays the addition of functionality to programs by means  of
> plugins is very frequent.
>
> I want to know the opinions of experienced Python developers about the
> best practices when it comes to developing apluginsystemfor a
> Python package.
>
> Should plugins be modules in a separate package?
> Should there be a registry  of available plugins? how would such a
> registry  be implemented? etc.
>
> thanks,
>
> Flávio

let me extend my original question with an example:

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?

I'd appreciate any comments.

Flávio




More information about the Python-list mailing list