Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mypy errors - Argument 1 has incompatible type "XComArg" #39514

Open
1 of 2 tasks
ampx-mg opened this issue May 9, 2024 · 2 comments
Open
1 of 2 tasks

mypy errors - Argument 1 has incompatible type "XComArg" #39514

ampx-mg opened this issue May 9, 2024 · 2 comments
Labels
area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet

Comments

@ampx-mg
Copy link

ampx-mg commented May 9, 2024

Apache Airflow version

Other Airflow 2 version (please specify below)

If "Other Airflow 2 version" selected, which one?

2.8.1

What happened?

Ever since upgrading to 2.8.1. from 2.7.3. we are experiencing a number of mypy errors regarding arg types, mainly

error: Argument 1 has incompatible type "XComArg"; expected "dict[Any, Any]"  [arg-type]

We use TaskFlow API and define the task dependencies exactly as in the example tutorial taskflow dag

order_data = extract()
order_summary = transform(order_data)
load(order_summary["total_order_value"])

and haven't changed anything else in our DAG definitions.

What you think should happen instead?

No such errors should be raised, as was the case in 2.7.3.

How to reproduce

Run mypy on the tutorial taskflow DAG https://github.com/apache/airflow/blob/main/airflow/example_dags/tutorial_taskflow_api.py module

Operating System

Ubuntu 22.04

Versions of Apache Airflow Providers

No response

Deployment

Official Apache Airflow Helm Chart

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@ampx-mg ampx-mg added area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet labels May 9, 2024
@jonathan-ostrander
Copy link

This was solved by #26023 but that code was moved under the dev directory by #28498. AFAIK the code from that directory isn't included in any kind of public release.

FWIW there are 2 workaround. You could copy that code into your own Airflow repo or just use cast on the operator as it's passed into the task method.

@eladkal
Copy link
Contributor

eladkal commented May 15, 2024

This was solved by #26023 but that code was moved under the dev directory by #28498. AFAIK the code from that directory isn't included in any kind of public release.

FWIW there are 2 workaround. You could copy that code into your own Airflow repo or just use cast on the operator as it's passed into the task method.

We have a task about mypy plugin
#38796

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet
Projects
None yet
Development

No branches or pull requests

3 participants