-
Notifications
You must be signed in to change notification settings - Fork 16.2k
Description
Apache Airflow version
3.1.0
If "Other Airflow 2/3 version" selected, which one?
No response
What happened?
Summary
This issue tracks the resolution of MyPy type errors found in the Airflow core codebase when SQLA 2 is used.
There are currently 525 errors across 100 files that need to be addressed before being able to upgrade to SQLA2.
Also, this will improve type safety and code quality.
How to generate the errors
-
Apply changes from Remove SQLA 1 limit in Fab provider #56212 locally
-
Run
breeze ci-image build --python 3.10 --upgrade-to-newer-dependencies -
Run
prek --color always --verbose --hook-stage manual "mypy-airflow-core" --all-filesreveals numerous type errors throughout the codebase. These errors primarily involve:- Incompatible type assignments (datetime vs UtcDateTime)
- Missing type annotations
- Union type handling issues
- SQLAlchemy ORM type mismatches
- Return value type inconsistencies
Current Status (Updated: 2025-11-24)
Total errors found: 24 errors in 8 files (checked 1021 source files)
Error Breakdown by Directory
airflow-core/src/airflow/models/ (13 errors in 4 files)
-
connection.py(1 error) -
taskmap.py(4 errors) -
dag.py(2 errors) -
serialized_dag.py(6 errors)
airflow-core/src/airflow/ti_deps/deps/ (10 errors in 1 file)
-
trigger_rule_dep.py(10 errors)
airflow-core/src/airflow/api_fastapi/common/db/ (1 error in 1 file)
-
dag_runs.py(1 error)
airflow-core/src/airflow/api_fastapi/execution_api/routes/ (2 errors in 1 file)
-
task_instances.py(2 errors)
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/ (1 error in 1 file)
-
dags.py(1 error)
How to Contribute
- Pick a file: Choose an unchecked file from the list above
- Check the box: Update this issue to mark the file as being worked on
- Run MyPy locally: Follow the steps mentioned above to generate the errors. You can also run
prek mypy-airflow-core --directory <directory>to runmypyin the directory you are working on - Fix the errors: Address the type errors in your chosen file
- Test your changes: Ensure tests still pass
- Submit a PR: Create a pull request with your fixes. Please do not include in your PR changes from Remove SQLA 1 limit in Fab provider #56212
Guidelines
- Focus on one file or directory at a time
- Follow existing code patterns and conventions
Let's work together to improve Airflow's type safety! 🚀
Note: This issue was generated by running MyPy on the current codebase. The error counts may change as the codebase evolves.
What you think should happen instead?
No response
How to reproduce
- Apply changes from Remove SQLA 1 limit in Fab provider #56212 locally
- Run
breeze ci-image build --python 3.10 --upgrade-to-newer-dependencies - Run
prek --color always --verbose --hook-stage manual "mypy-airflow-core" --all-filesreveals numerous type errors throughout the codebase
Operating System
Macos
Versions of Apache Airflow Providers
No response
Deployment
Other
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
- I agree to follow this project's Code of Conduct