This project is a simple plugin framework for Python 3.
It is a fork from A Simple Plugin Framework by Marty Alchin.
Régis Décamps maintains this project.
- The program is extensible, and extensions are made on mount points.
- A specific mount point is defined as a class with
metaclass=spf.MountPoint - An extension comes as independant class that inherit from the appropriate mount point.
- A plugin is a package of one or more extensions. It comes as a python package.
- Importing the plugin is enough to active the mount point and glue all code together.
- The class
MountPointas well as utility functions constitute the framework and are shipped inspf.py- utility method
load_plugins()loads all plugins in thepluginsdirectory - utility decorator
ExtensionsAt(klassMountPoint)returns a list of extensions that are loaded for this mount point.
- utility method
In this sample
program.pyis a simple program that prints "hello world" with a transformation performed by all plugins- The mount points for this sample are in
mount_point.py- The mount point
TextTransformerexpects a methodtransform_text(string)
- The mount point
- The plugins are placed in the directory
pluginsand loaded with the utility functionspf.load_plugins()- There is only one plugin called
html_transformerthat ships three extensions for the mount pointTextTransformer
- There is only one plugin called
This project also has an introduction on my blog.