icecube/skyllh

Add required tool version specification

Closed this issue · 0 comments

martwo commented

It should be possible to specify a specific, minimal, or maximal version of a required tool.
This could be implemented by supporting a 2-element tuple for each tool where the first specified the name of the tool and the second element the required version.

Application for this would be "photospline" with version ">=2.2.0".

Supported comparisons should equal (==), less-or-equal-than (<=), and greater-or-equal-than (>=).

By specifying a tool twice with <= and >= a valid range of versions can be specified.

def requires(*tools):
"""This is decorator function that can be used whenever a function requires
optional tools.
Parameters
----------
*tools : sequence of str
The name of the required Python packages.
Raises
------
ModuleNotFoundError
If any of the specified tools is not available.
"""