Building a minimal plugin architecture in Python

Mine is, basically, a directory called “plugins” which the main app can poll and then use imp.load_module to pick up files, look for a well-known entry point possibly with module-level config params, and go from there. I use file-monitoring stuff for a certain amount of dynamism in which plugins are active, but that’s a nice-to-have.

Of course, any requirement that comes along saying “I don’t need [big, complicated thing] X; I just want something lightweight” runs the risk of re-implementing X one discovered requirement at a time. But that’s not to say you can’t have some fun doing it anyway 🙂

Leave a Comment