Hi Flyte folks, does the Optional type has to be d...
# flyte-support
m
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
I've also seen this same thing 😢
have been having to import from typing for all Flyte stuff and it hurts my eyes (joking, it's totally fine)
😆 1
t
Optional[str]
is the right way to annotate; have you been encountering any issues?
r
Python 3.10 allows str l None
t
@high-accountant-32689, is this something we can support in flytekit?
h
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?
t
164 Views