Designing a Plugin System

in «tip» by Michael Beard
Tags: , , , , , , ,

Here is a little research that I did on finding how others did a plugin system.

This article - Designing a JavaScript Plugin System goes through and explains a simple plugin architecture that could be used in any system -- JavaScript, Python, or whatever.

Plugins are a common feature of libraries and frameworks, and for a good reason: they allow developers to add functionality, in a safe, scalable way. This makes the core project more valuable, and it builds a community — all without creating an additional maintenance burden. What a great deal!

So how do you go about building a plugin system? Let’s answer that question by building one of our own, in JavaScript.

It goes through a couple of examples (simplest, but has some dangers) and a slightly more complex one that limits what a plugin can do.

As an aside, while looking at this, I decided to see how jrnl implemented it's plugin system. Here is what I found:

  • only for import/export of a entry/journal
  • used the __init__.py in the plugin directory to supply the entry points to the plugin system and what gets included
  • only specific entries get included -- i.e. you have to manually include them, which seems reasonable

It seems to go along with what was stated in the article above.

Here are some other good resources: