<#1337 flytekit - support NamedTuple as input type...
# flytekit
c
#1337 flytekit - support NamedTuple as input type Issue created by tekumara Motivation: Why do you think this is important? NamedTuples can be used to name outputs of tasks and workflows. But when used as inputs to a task, eg:
Copy code
from 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:
Copy code
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/flyte