Third Party Plugins
When writing plugins, please prefix the name with 'df-' so they are easy to keep track of. We can automatically generate a list of all doapfiend plugins by monitoring The Python Package Index.
- df-html - Creates HTML & CSS from a project's DOAP
- df-foaf - Allows you to find DOAP from FOAF, browse FOAF linked from DOAP etc.
- df-gentoo - Search for DOAP using a Gentoo Linux package name
- df-vcs - Run a VCS command using DOAP to find an SVN, CVS, etc. URL to do checkouts or list repositories
- df-trac - Display DOAP as human readable plain text in a Trac wiki using a macro!
Writing Plugins
doapfiend supports setuptools entry point plugins.
There are two basic rules for plugins:
- Plugin classes should subclass doapfiend.plugins.Plugin.
- Plugins may implement any of the methods described in the class PluginInterface in doapfiend.plugins.base. Please note that this class is for documentary purposes only; plugins may not subclass PluginInterface.
Registering
For doapfiend to find a plugin, it must be part of a package that uses setuptools, and the plugin must be included in the entry points defined in the setup.py for the package:
setup(name='Some plugin', ... entry_points = { 'doapfiend.plugins': [ 'someplugin = someplugin:SomePlugin' ] }, ... )Once the package is installed with install or develop, doapfiend will be able to load the plugin.
Defining options
All plugins must implement the methods add_options(self, parser, env) and configure(self, options, conf). Subclasses of doapfiend.plugins.Plugin that want the standard options should call the superclass methods.
doapfiend uses optparse.OptionParser from the standard library to parse arguments. A plugin's add_options() method receives a parser instance. It's good form for a plugin to use that instance only to add additional arguments that take only long arguments (--like-this). Most of doapfiend's built-in arguments get their default value from an environment variable. This is a good practice because it allows options to be utilized when run through some other means than the doapfiendtests script.
A plugin's configure() method receives the parsed OptionParser options object, as well as the current config object. Plugins should configure their behavior based on the user-selected settings, and may raise exceptions if the configured behavior is nonsensical.
Logging
doapfiend uses the logging classes from the standard library. To enable users to view debug messages easily, plugins should use logging.getLogger() to acquire a logger in the doapfiend.plugins namespace.
![(please configure the [header_logo] section in trac.ini)](http://doapspace.org/static/doapfiend.png)