I really took the opportunity to dig into the Yapsy api and the code of the PluginManager this week. I started drafting notes for the tutorial on using the plugin management system with Freeseer. The basic version for writing a new plugin is: write a config file ‘some-plugin-name.freeseer-plugin’ add a directory ‘some-plugin-name’ (the names must be the same) in the __init__.py file in the directory write a class that extends one of the IPlugin sub-classes add other useful code to that same directory as needed. That’s the brief version, I’m fleshing out a more polished version (will post when ready).
For the most part the Yapsy documentation is fairly straightforward once you take the time to go through it and after I had read all the Yapsy documentation the Freeseer plugin code was fairly straightforward to follow, although I did run into a bit of confusion when I was looking at the src/freeseer/plugins directory since any plugin needs to be sub-classed from the IPlugin class and I initially couldn’t find any code that implemented IPlugin or sub-classes in the plugins folder or it’s sub-directories. So I ended asking on irc and Thanh let me know that the code was in the __init__.py files in the plugins sub-directories. I have viewed a number of the __init__.py files in other directories and they had all been empty so I had assumed that they were all empty and didn’t even check those files (I know, I know, never assume …) I felt a bit silly about that since a simple recursive grep through the code would have answered my question, but what can I say? I’m new to python and these things happen. I did, of course, use a recursive grep to answer my other question, ‘how do the plugins actually get used by other code in the project?’ It is fairly simple, PluginManager object is instantiated and then the plugins are accessed through that object. All-in-all this is a simple and straightforward plugin system.
As I was working through things this week I decided that it would make sense to switch the order of a few of the milestones in my project document so the next 2 things I’m planing to do are: 1. research how unit testing is done in python and in this project (the documentation of this looks good so I’ll be starting there), and 2. design a proof-of-concept importer plugin. I’m planning on having both of these done by the end of the week or sooner.