Anyone using latest `mypy` and have this issue wit...
# flytekit
g
Anyone using latest
mypy
and have this issue with
NamedTuple
(for named outputs). The example in the docs (shown below) fails mypy 0.910 Code from Flyte docs:
Copy code
import typing

from flytekit import task

hello_output = typing.NamedTuple("OP", greet=str)


@task
def say_hello() -> hello_output:
    return hello_output("hello world")
Error:
Copy code
mint/workflows/tmp.py:5:16: error: Unexpected arguments to namedtuple()  [misc]
    hello_output = typing.NamedTuple("OP", greet=str)
                   ^
mint/workflows/tmp.py: note: In function "say_hello":
mint/workflows/tmp.py:10:12: error: Too many arguments for "hello_output"  [call-arg]
        return hello_output("hello world")
               ^
Is solution here to just
type: ignore
for now and we can bring this up to the
mypy
people?
s
Hi @Greg Gydush!
hello_output = typing.NamedTuple("hello_output", [("greet", str)])
works. @Yee, should we modify all the NamedTuple examples in the docs to keep them in sync with mypy?
🙏 1
211 Views