Is it possible to type-hint a decorated task for use as a templated operator parameter? #45247
Answered
by
potiuk
MatrixManAtYrService
asked this question in
General
-
This appears to work just fine, but my type checker doesn't like it. from airflow.decorators import dag, task
from airflow.providers.slack.operators.slack import SlackAPIPostOperator
@task
def foo():
return "foo"
@dag()
def say_foo():
# Type checker dislikes the below call to foo()
#
# > Argument of type "XComArg" cannot be assigned to parameter "text" of type "str" in function "__init__"
# > "XComArg" is not assignable to "str"
SlackAPIPostOperator(task_id="send_message", channel="#my-channel", text=foo())
dag = say_foo() I can |
Beta Was this translation helpful? Give feedback.
Answered by
potiuk
Dec 27, 2024
Replies: 1 comment 2 replies
-
There is an issue for it waiting for somoene to implement it #19884 |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
MatrixManAtYrService
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is an issue for it waiting for somoene to implement it #19884