Skip to content

ENH: allow typing.Union in action outputs - #754

Closed
misialq wants to merge 1 commit into
rachis-org:devfrom
misialq:unionized-outputs
Closed

ENH: allow typing.Union in action outputs#754
misialq wants to merge 1 commit into
rachis-org:devfrom
misialq:unionized-outputs

Conversation

@misialq

@misialq misialq commented Feb 26, 2024

Copy link
Copy Markdown
Contributor

Hey @ebolyen, @lizgehret,

It's been bugging me for a while now that a single action cannot output artifacts of different semantic types if their output data type indicated on the function signature differs. For example, in the use case I recently posted on the forum I'd like to produce the following two kinds of outputs:

  1. SampleData[BLAST6] -> SeedOrthologDirFmt
  2. FeatureData[BLAST6] -> BLAST6DirectoryFormat

I cannot do that, since the two directory formats are different (and they are not easily "transformable"). I tried adapting the SDK to enable this by using a Union of output types (see below), similarly to how it was done for the input unions. Does this makes sense to you? If yes, I'd love to add some tests - it would be super-helpful if you could point me as to where they should live as I cannot really find a good spot 😅

if isinstance(output_view, arg):
# we need a new spec with the correct view type
spec = ParameterSpec(
qiime_type=spec.qiime_type, view_type=arg,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having not looked very much into it, should this be something we handle in transform.py? It's a scary place, but it seems like where I would expect to deconstruct the union.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ebolyen, I did have a look but tbh I wasn't sure how exactly to do it there... If you have any hints, let me know 🙏

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ebolyen, resurfacing this thread - any thoughts on the above?

@colinvwood

Copy link
Copy Markdown
Collaborator

implemented in #961

@colinvwood colinvwood closed this Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants