Alexander van Eck09/02/2021, 9:55 AM
mypy complains with
var: str = Parameter('var')
Even though after calling this will be a string 🤔 Any thoughts on how to achieve this?
Incompatible types in assignment (expression has type "Parameter", variable has type "str")
Bouke Krom09/02/2021, 11:53 AM
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.
with Flow(name) as flow:
until it's evaluated at flow run time. A couple possibilities I can think of 1. use a union of types
2. tell mypy to ignore it
var: Union[str, Parameter] = Parameter('var')
We're working on some features that will allow Parameter typing (and enforcement of typing!!) in the future.
var: str = Parameter('var') # type: ignore
Alexander van Eck09/02/2021, 1:51 PM
where necessary. but it looks like when passing Parameter into a prefect task it actually doesn’t complain! Just when using Parameter directly