Alexander van Eck
09/02/2021, 9:55 AMvar: str = Parameter('var')
mypy complains with
Incompatible types in assignment (expression has type "Parameter", variable has type "str")
Even though after calling this will be a string 🤔
Any thoughts on how to achieve this?Bouke Krom
09/02/2021, 11:53 AMwith Flow(name) as flow:
context, the returned value will actually not be a string but a task... We didnt implement type checking on tasks/parameters though, so I'm not sure how to solve it.Zach Angell
09/02/2021, 1:50 PMvar
IS a Parameter
until it's evaluated at flow run time.
A couple possibilities I can think of
1. use a union of types
var: Union[str, Parameter] = Parameter('var')
2. tell mypy to ignore it
var: str = Parameter('var') # type: ignore
We're working on some features that will allow Parameter typing (and enforcement of typing!!) in the future.Alexander van Eck
09/02/2021, 1:51 PMcast
where necessary. but it looks like when passing Parameter into a prefect task it actually doesn’t complain! Just when using Parameter directly