API¶
-
class
gdaps.
Interface
¶ Base class for interface definitions.
Inherit from Interface and eventually add methods to that class:
class IMyInterface(Interface): def do_something(self): pass
You can choose whatever name you want for your interfaces, but we recommend you start the name with a capital “I”. Read more about interfaces in the Interfaces section.
-
gdaps.
implements
¶ alias of
gdaps.Implements
-
class
gdaps.
ExtensionPoint
(interface: Type[gdaps.Interface])¶ Marker class for Extension points in plugins.
You can iterate over ‘Extensionpoint’s via
for..in
:ep = ExtensionPoint(IMyInterface) for plugin in ep: plugin.do_something()
-
extensions
() → set¶ Returns a set of plugin instances that match the interface of this extension point.
-
-
class
gdaps.
Implements
(*interfaces)¶ Decorator class for implementing interfaces.
Just decorate a class:
@implements(IMyInterface) class PluginA: def do_something(self): print("Greetings from PluginA")
You can also implement more than one interface: @implements(InterfaceA, InterfaceB) and implement all their methods.
Read more about implementations in the Implementations section.