Skip to content

Pipelines with multiple inputs #29

Open
@lschr

Description

I was thinking about implementing support for multiple inputs (and maybe outputs) to pipelines. For example, it would be nice to be able to

@pipeline
def add(a1, a2):
    return a1 + a2

i1 = pims.open("img1.tif")
i2 = pims.open("img2.tif")
i12 = add(i1, i2)

Before I start I wanted to ask how to go about it. A few possibilities, decreasing in elegance (in my opinion) but increasing in API compatibility:

  • Extend the Pipeline class (and pipeline decorator)
    • Rearrange __init__ arguments: def __init__(proc_func, *ancestors, propagate_attrs=None). This breaks the API.
    • Keep __init__ arguments in order: def __init__(*args, propagate_attrs=None), where args[-1] is proc_func. This turns propagate_attrs into a keyword-only and proc_func and ancestor into positional arguments but otherwise preserves the API.
    • Preserve the API: def __init__(ancestor, proc_func, propagate_attrs=None, *other_ancestors)
    • Some middle ground between the above
  • Create a new class (and decorator). Complete freedom since there is no backward-compatibility to think of.
  • Something else I did not think about

Which is the preferred way?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions