GitHub user amcraig created a discussion: Airflow Incompatibility with 
Pylance/Pyright

### Apache Airflow version

3.1.0

### If "Other Airflow 2/3 version" selected, which one?

This also occurs in 2.11

### What happened?

This drives me nuts, Pylance doesn't seem to be able to pick up correct 
stubs/typing for Airflow.
Ruff doesn't have issues with the code.

I have ensured VSCode is using the correct PythonPath for my Airflow project.

Common issues include: 

- XCom typing between Tasks
- ObjectStoragePath and UPath type differences 
- DAG operators `>>` are flagged as not being supported for the tasks
- Complains about unused values in DAG definitions

Is there anything I can do to alleviate this, or am I faced with just 
ignoring/turning off my linter for Airflow development?

Here's an example DAG which throws Pylance linting error:

<img width="872" height="826" alt="Image" 
src="https://github.com/user-attachments/assets/1a0a6558-c1af-4110-8731-33136507d1da";
 />

### What you think should happen instead?

I'd expect that Airflow should work nicely with Pylance/Pyright.

### How to reproduce

Just create a simple DAG like the one in the screenshot provided using 
ObjectStorage.
An easy linting error is to reproduce is to return a ObjectStoragePath from one 
task and consume that same ObjectStoragePath in the next task.
The Type of the ObjectStoragePath seems to be lost after passing through XComs

### Operating System

MacOS

### Versions of Apache Airflow Providers

apache-airflow-providers-google==18.0.0
apache-airflow-providers-standard==1.8.0

### Deployment

Virtualenv installation

### Deployment details

This is just experienced in local dev

### Anything else?

_No response_

### Are you willing to submit PR?

- [ ] Yes I am willing to submit a PR!

### Code of Conduct

- [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)


GitHub link: https://github.com/apache/airflow/discussions/57038

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to