cuddly-jelly-27016
05/14/2025, 12:12 AMfrom typing import NamedTuple
from flytekit import task
nt = NamedTuple("nt", its_a_kind_of=str)
# this works
@task
def generate_reference_data() -> nt:
return nt(its_a_kind_of="MAGIC")
# this will error
@task
def process_reference_data(data: nt) -> str:
return data.its_a_kind_of
Flytekit will error with:
Transformer for type <class 'tuple'> is restricted currently
Goal: What should the final outcome look like, ideally?
Ideally a NamedTuple could be passed directly as an input to a task.
Describe alternatives you've considered
At the moment, NamedTuples have to be manually unpacked and their individual fields passed as arguments.
flyteorg/flytecuddly-jelly-27016
05/14/2025, 12:12 AM