Archit Rathore
04/18/2024, 2:03 PMflytekit.task
returns a union of PythonFunctionTask
, FuncOut
, Promise
the typechecker’s utility is greatly reduced.
Is there a paved path to preserving the original function’s return type? Or some other way that is peaceful with the typechecker (using pyright)?Archit Rathore
04/18/2024, 2:04 PM@dataclass_json
@dataclass
class InnerDC:
subfield: str
subpath: str
@dataclass_json
@dataclass
class OuterDC:
name: str
path: str
inner_dc: InnerDC
uid: Optional[int] = None
@task
def make_test_dc(name: str, path: str, subfield: str, subpath: str) -> OuterDC:
return OuterDC(name=name, path=path, inner_dc=InnerDC(subfield=subfield, subpath=subpath))
@task
def extract_subpath(dc: OuterDC) -> str:
return dc.inner_dc.subpath
@workflow
def wf(name: str, path: str, subfield: str, subpath: str) -> str:
dc = make_test_dc(name=name, path=path, subfield=subfield, subpath=subpath)
return extract_subpath(dc=dc)
Yee
Yee
Archit Rathore
04/19/2024, 2:29 PMTypedTask
protocol to overload the return type to be the same as the decorated function which is a decent compromise for now, but with some obvious downsides (no kwargs info, no docstrings etc)Yee
Yee
Archit Rathore
04/19/2024, 4:21 PMLen Strnad
05/10/2024, 8:22 PMYee
Yee
Yee
Len Strnad
05/10/2024, 8:50 PMYee
Yee
Eduardo Apolinario (eapolinario)
05/11/2024, 12:49 AMThomas Fan
05/11/2024, 2:29 AM