Making Python plugins easier
When I was working on my IRC bot, I wanted to make it as modular as possible so that other people could write plugins for it. Ideally someone could write a plugin, and after dropping it in a ‘modules’ directory, all the new functionality would be automagically added to the bot. Much like Supybot is able to do.
I ended up getting a system put together that pretty much did what I wanted. But I couldn’t help but thinking the whole time that this is a problem that has probably been solved before… and in far more elegant ways than my messy code.
Tonight I came across Sprinkles. It claims to be a “library to assist you in making your applications easily support plugins.” Sounds good. Unfortunately, I can’t quite navigate the author’s site to see exactly how development is going. And I’m always wary of making my applications depend on a library that some guy cranked out in an evening.
Update: Andy was kind enough to update his site with the SprinklesPy docs. If you need a plugin system for your Python app, check it out.
Update 2: It looks like you can do some interesting stuff when you add some Sprinkles to your web framework.

Funny, I know the guy. He uses it quite often from what I hear. He’s very accessible… talk to him. :P
Hey there, sorry about being unable to navigate my site, I’ve been a bit lazy about fleshing out my wiki, and even actually updating the docs for this most recent version of sprinkles. But, since I am a sucker for attention, I’ll go clean that stuff up now and post another comment when it is … presentable.
Alright, here ya go: http://termie.pbwiki.com/SprinklesPy
Whoa, awesome!
I certainly didn’t mean you had to update your website just because of me. :) But much appreciated. I’ll check that out this week (hopefully tonight)!
Thanks,
John
Got it installed tonight, but didn’t get a chance to try it out. I can import the module ok though. :)
Maybe tomorrow.
You should check out setuptools for doing plugins. It’s actually one of the major features of Python Eggs. If you take TurboGears widgets, for example, you can do:
easy_install Lightbox
tg-admin toolbox
The first command installs the Lightbox and Scriptaculous widgets (because of dependencies). The second command will run the Toolbox which has a “widget browser”. Both Lightbox and Scriptaculous will show up there… no configuration needed. no dropping in special directories, either!