Hi folks,
is there a way to set the expected type for a Parameter?
I have a parameter which is a string, but when passing it to tasks, Pycharm raises a warning about type mismatch…
d
Dylan
11/19/2020, 2:48 PM
Hey @ale!
When you pass data between tasks in a Prefect Flow, you’re actually passing Task Results (since the actual data is passed at runtime, not build time). That’s likely the source of the pycharm type mismatch. In the task that accepts the parameter, is the type a string at runtime?
a
ale
11/19/2020, 2:52 PM
Yep, the runtime type is a string, so no problems during execution.
It’s just somehow annoying during development 😬
d
Dylan
11/19/2020, 3:10 PM
If you think there’s a way to improve the experience, feel free to open an issue with your suggestion! 😄
a
ale
11/19/2020, 3:59 PM
I’ll think about it 🙂
I asked because I was not sure if I was making some mistake when using parameters.
Thanks @Dylan 👍
d
Dylan
11/19/2020, 3:59 PM
👍 anytime!
s
Saulius Beinorius
11/20/2020, 4:31 PM
I investigated this a bit (because I saw other libraries like
pydantic
having classes that are able to masquerade as other types) and I came up with this snippet, with the bonus of having a transformation function akin to `argparse`:
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.