The following task definition:
@task
@annotate({"return": {"smoothed_image": Path}})
def smooth_image(input_image: Path, smoothed_image: Path | None) -> Path:
...
triggers an error:
TypeError: TypeParser doesn't know how to handle args ((<class 'pathlib.Path'>, <class 'NoneType'>)) for <class 'types.UnionType'> types in 'smoothed_image' field of Inputs
Notation X | None is becoming popular, and sometimes autoformatted by linters like Ruff. It would be great if Pydra's internal parsing mechanism were able to inject the necessary required / optional metadata to the fields, or at least not crash since this is a valid function definition.