[Python-Dev] Py plugins architecture - Trac [WAS:] "setuptools has divided the Python community"

Olemis Lang olemis at gmail.com
Thu Mar 26 15:29:40 CET 2009


On Wed, Mar 25, 2009 at 6:08 PM, Barry Warsaw <barry at python.org> wrote:
> On Mar 25, 2009, at 11:35 AM, Olemis Lang wrote:
>
>> Yes you're right, Trac requires .egg files for local plugins installs
>> (... in /plugins folder ;) so that not all environments but only one
>> be able to use the plugin ... but that's not exactly what I'm saying,
>> since setuptools AFAIK *MUST* be already there ... so Trac depends on
>> setuptools.
>
> I've not looked at Trac's plugin architecture, but I wonder, how much of it
> is generic enough to be useful for any application?  I've found setuptools
> entry points difficult to work with for plugins, and I think the Python
> ecosystem could benefit from more shared wisdom, if not code, in designing
> plugin frameworks for applications.
>

Well ... I'm not pretty sure about following this here (py-dev)
however, I'll do my best effort to try to explain a little about it
and provide you some pointers ... ;)

- Trac plugin architecture (... which is a little bit «meta» ...) is
based on a few classes (... and more of them under the hood ... ;)
  1 - Interface ... includes the protocol used to interact with the
specific plugin
  2 - Component ... The base class for implementing the plugin functionality ...
  3 - ComponentManager ... represents something managing many
components | plugins ... (e.g. Trac environments are «represented» as
instances of trac.env.Environment class and it is nothing but a direct
descendant of ComponentManager ... ;).
  4 - ExtensionPoint ... to access all the plugins implenting an
specific interface ...
  5 - A few other «cosmetic» features like Configurable items and
classes (i.e. descriptors ;) to access configuration options ...

In theory people can implement their own descendants of
ComponentManager and do things the way they want to (... at least Noah
K. -trac dev- has mentioned that he has used Trac architecture for
«his own apps» ... and I have, but only for «my own» *web* apps ... I
have no experience about desktop or GUI or other apps ...) ...

It relies on pkg_resources entry points support in order to «load» the
plugins ...

Besides you can read Trac docs for further details ... AFAIK they'll
attend to PyCon'09 ... talks (... hopefully recorded ;) + sprint ...

PS: Edgewall guys have also done a great job in building another great
package for i18n ... and AFAICR it is based on a simpler pluggable
architecture relying on setuptools too ... (... CMIIW anyway ;) I am
talking about Babel ...

-- 
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:


More information about the Python-Dev mailing list