Plugin framework - Overcomplicating things?

hajducko at gmail.com hajducko at gmail.com
Thu Mar 27 00:50:56 EDT 2008


As a side project and a learning experience and ultimately, a good
tool for my department, I started developing a simple jabber bot for
our work's conference server, with the intention of making it capable
of running specific commands and utilities.  I realize there are other
bots out there, but I thought this would be a good first python
project for me.  Most of my current scripts/utilities are in perl or
php, so the OO world is a little new.

In any case, I wrote up a Bot class, got it to connect, join rooms,
see chat, and the world rejoiced.  Now, instead of writing a
monolithic function for the message handler to deal with all the
incoming text and all the possible cool things I could do with the bot
like intranet lookups, dns checks, etc, I thought to myself: "self,
wouldn't it be cool if you made a plugin framework that could read in
a bunch of plugins and the bot could hand off the text to a plugin
that was looking for that command and it could do the job".  Then the
smarter side of myself said "self, you have no frak'n idea how to do
that".

So I've been scouring this list for days, reading some of the past
conversations.  I investigated the trac component system, downloaded
the source and tried my best to make heads ( or tails, take your
pick ) of it.  I looked at setuptools and eggs, I looked at Marty's
simple framework at http://gulopine.gamemusic.org/2008/jan/10/simple-plugin-framework/
and I searched all over google for anything, even stuff that was non-
python specific and just detailed plugin frameworks in theory ( I
didn't find any good ones, so if you have some links, gimme. :) ) and
I'm sorry say, but I still don't get it.  While I understand half of
it, I'm still not getting the point of using it for something like
what I'm trying to accomplish.

All this comes to my question - am I overcomplicating this project? I
can understand the use of something like the trac component system if
I had multiple components and plugins that handled different areas of
my project and different points of interaction, but I don't.  I've got
exactly one spot where I want to check all my plugins and hand off the
message to which ever ones are looking for that command.  So really,
should I even bother with trying to setup some framework for this or
should I just be doing a simple loop over a directory, importing all
the plugins and storing them in a list and then looping over them in
the message handler to see which ones were looking for the command and
letting them do their thing?  I don't see the advantage I'd get from
implementing something more complicated at this point.  If you could
show me the yellow brick road or offer any pointers, I'd appreciate
it.  I'm more than willing to go off reading more pages, but when the
first 5 pages of a google search for 'plugin framework design' shows
all purple, visited links and I'm still not getting it, I finally
decided to turn here to the list and get some professional advice.

As an aside, if there is anyone who is an experience developer and
designer and is willing to take some private correspondence, please
let me know.  I feel embarrassed for asking, but I've got a alot of
questions that I don't want to litter this list with and would rather
voice them in private.

Thanks,

steve









More information about the Python-list mailing list