plugin development best practices

Flavio fccoelho at gmail.com
Thu Feb 22 10:01:58 EST 2007


On Feb 22, 12:51 pm, "Flavio" <fccoe... at gmail.com> wrote:
> On Feb 22, 12:36 pm, "Diez B. Roggisch" <d... 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. It's just one way of doing it. But it requires you to have
> > all plugins being part of one module, in one location. Depending on what
> > you want to do, this won't suffice. For example if your app is installed in
> > a system path you aren't supposed to write to - how do you install your
> > individual plugin? easy_install allows you to install to a folder that is
> > contained in the PYTHONPATH, and then you can discover entrypoints.
>
> > But please, do as we suggested: read the past discussions.
>
> > Depending on what _you_ actually want to accomplish, you're proposal is
> > enough. But don't expect it to become the "one plugin system to rule them
> > all"-solution.
>
> > diez
>
> Oh, I have read all the links that have been suggested, but I am
> looking for the simplest possible solution.
>
> I have no intention to create the "next Plugin system" I am just
> trying to solve my own problem and in the process leave a record of a
> fruitfull discussion about plugin systems.
>
> BTW I have yet to check TRAC's plugin system.

I have look at Trac's component based pluging system and I liked it
very much. If external dependencies is not an issue I believe this is
the best solution.
http://trac.edgewall.org/wiki/TracPlugins




More information about the Python-list mailing list