nipype / pydra

Pydra Dataflow Engine
https://nipype.github.io/pydra/
Other
119 stars 57 forks source link

Shortcut for equal-separated option value pairs #703

Open ghisvail opened 9 months ago

ghisvail commented 9 months ago

Certain CLI parsers, such as FSL's Eddy, implement a rigid formulation where only equal-separated options (--long-option=value) are accepted and space-separated ones (--long-option value) are rejected. Pydra implements space-separated options, which are common to short and long option names in modern standards.

Sadly, this complicates specification definition slightly with repetition:

class InputSpec(ShellSpec):
    input_image: PathLike = field(
        metadata={
            "help_string": "input image",
            "argstr": "--imain={input_image}",
        }
    )
    ...

There is a notion of separator in Pydra's field metadata, but it is used for lists of values.

Maybe we could introduce an option separator (defaults to whitespace if unspecified), such as:

class InputSpec(ShellSpec):
    input_image: PathLike = field(
        metadata={
            "help_string": "input image",
            "argstr": "--imain",
            "optsep": "=",
        }
    )
    ...
satra commented 9 months ago

Pydra implements space-separated options, which are common to short and long option names in modern standards.

pydra actually follows nipype in this perspective and allows various formulations.