Plugins¶
You can write and maintain your own scripts and still invoke them from Maloja. The advantage of that is to make use of survey data which you can search for in the Maloja console and pass to your scripts interactively.
Your script must contain three things:
For reference, see the example in maloja.plugin.vapplicator.
Selector function¶
-
maloja.plugin.vapplicator.
selector
(*objs)[source]¶ Your selector function accepts one or more objects from the Maloja data model.
If these are not sufficient for the operation of your workflow, the function should return
maloja.workflow.utils.Path
objects to indicate what is required to satisfy selection.Your function returns a Workflow class if the objects satisfy your selection criteria.
Workflow class¶
Your Workflow should be implemented as a callable object.
Plugin declaration¶
Maloja uses Python entry points to define an interface for third party plugins. The interface is called maloja.plugin.
In order for Maloja to detect your plugin, you must package your scripts as an installable Python distibution, and make an entry point declaration in your setup.py.
Here’s what that would look like for a script called myscript in a package mypackage:
entry_points={
"maloja.plugin": [
"myplugin = mypackage.myscript:plugin",
],
},
The target for the entry point is a module-level variable of type
maloja.types.Plugin
.