Hi Flyte folks, does the Optional type has to be defined like this
Copy code
@task
def hello(username: Optional[str]) -> str:
because i tried to define like this
Copy code
@task
def hello(username: str | None) -> str:
but getting
Failed with Unknown Exception <class 'AssertionError'> Reason: Failed to Bind variable username for function sandbox.subworkflow.hello.
first one works though
r
rich-garden-69988
05/23/2023, 6:16 PM
I've also seen this same thing 😢
rich-garden-69988
05/23/2023, 6:17 PM
have been having to import from typing for all Flyte stuff and it hurts my eyes (joking, it's totally fine)
😆 1
t
tall-lock-23197
05/24/2023, 4:51 AM
Optional[str]
is the right way to annotate; have you been encountering any issues?
r
rich-garden-69988
05/24/2023, 5:10 AM
Python 3.10 allows str l None
t
tall-lock-23197
05/24/2023, 5:18 AM
@high-accountant-32689, is this something we can support in flytekit?
h
high-accountant-32689
05/24/2023, 5:37 PM
as Greg said, this is a python 3.10 feature described in https://peps.python.org/pep-0604/.
We'll have to investigate how to handle this version-specific typing info. It might be doable. Can you create a ticket to track this investigation?