PyWPS Profiles


Work in progress.


It happens quite often that we have a set of processes with common input (and output) parameters. In WPS the process signature (inputs+outputs) is called a WPS profile. In the following we show examples how to avoid copy+paste of these process parameters.

Python Mixins

One could use Python mixin classes to define a commonly used profile which can be adapted by each individual process.

See how a mixin class looks like:

See notebook examples how it could be used with PyWPS:

Python Decorators

We can also use function decorator to define a WPS profile for PyWPS.

See how a function decorator looks like:

Here are some notebook examples how it could be used with PyWPS:

Simple Alternative: Shared Profile Module/Class

Relatively few developers will be familiar with the concepts of mixins and decorators. In other words, it might look a bit too much like magic. We could also simply create a module with all the common inputs and outputs used throughout the different WPS processes ( For a given Process definition, one then just import wpsio and refer to the objects in the inputs and outputs fields of the Process.init method.

See for example:

Here is a notebook showing this approach which includes also an optional decorator: