https://flyte.org logo
#ask-the-community
Title
# ask-the-community
d

Dennis O'Brien

12/12/2023, 9:51 PM
Hi -- I'm interested in eliminating type annotation errors on flyte workflow files as reported by
pyright
or
mypy
. We recently updated to
flytekit==1.10.2
(from
1.7.0
). I first removed the decorators
@dataclass_json
based on PR-1801, and that does eliminate many of the false positive reported by the static type checking tools. But I'm still seeing a lot of errors like this:
Copy code
error: Expression of type "Tuple[Promise] | Promise | VoidPromise | Tuple[Unknown, ...] | None" cannot be assigned to declared type "TrainDatasetParameters"
error: "VoidPromise" is not iterable
error: Expression with type "Tuple[Promise] | Promise | VoidPromise | Tuple[Unknown, ...] | None" cannot be assigned to target tuple
error: Operator ">>" not supported for types "Tuple[Promise] | Promise | VoidPromise | Tuple[Unknown, ...] | None" and "DataFrame"
I am also getting a few new type check errors like this:
Copy code
Argument of type "PythonFunctionWorkflow | ((...) -> bool)" cannot be assigned to parameter "workflow" of type "WorkflowBase" in function "get_or_create"
But I think these might be real.
This issue looks like it is related to the first error message included.
Copy code
error: Expression of type "Tuple[Promise] | Promise | VoidPromise | Tuple[Unknown, ...] | None" cannot be assigned to declared type "TrainDatasetParameters"
https://github.com/flyteorg/flyte/issues/3682
And this is another related issue: https://github.com/flyteorg/flyte/issues/2525
And there's a related open feature request about support for
pydantic
data classes. https://github.com/flyteorg/flyte/issues/1823
It would be great to have some sort of doc describing what is supported and what is not with type annotations and static type checking.
s

Samhita Alla

12/14/2023, 9:58 AM
okay. would you mind creating an issue?
d

Dennis O'Brien

12/16/2023, 1:05 AM
I added some information to https://github.com/flyteorg/flyte/issues/3682 I think that existing issue is a good summary of the situation. I added an even simpler example showing the problem.