Interfaces and entry_points are described in plugin documentation. Generally, a plugin code looks like:
Once this class has been written, just register it in the setup.py file of your python package.
entry_points={
'oalab.applet': [
'oalab.applet/mypackage = mypackage.plugin.applet', # read all plugins defined in this module ...
]
}
Note
You can also define a plugin explicitly with:
With mypackage.plugin.applet python module path (equivalent to 'mypackage/plugin/applet.py').
In openalea packages, plugin follow this convention:
Generally, API are described from documentation or interface classes.
This module contains Plugin class, describing plugins that extend package itself or another package. Generally, these plugin define "default" or "standard" implementation and algorithms (if extend package itself) or alternatives (if extends an other package). Real implementation (class, algo, ...) are generally defined in an other module with explicit name.
Builtin plugin for package itself can also be used, by contributors, as real example of how to create a new plugin.
ex: openalea.core.plugin.builtin.applet
You are free to put real implementation (class or algo) in the module of your choice. Implementation are classical python objects (except that its follow a special API), so you can put code where you want, like you will do for other libraries. Follow a special interface doesn't mean class is derivated from an interface, just is has same public attributes and same methods.
Generally, package.category.implementation_name fit well.
ex: openalea.oalab.applet.filebrowser
or with a more generic package name:
ex: openalea.oalab.widget.filebrowser
In all cases, this path is defined in plugin class and you don't need to remember were package is defined.