Repository navigation
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
Activity
Fix MyPy type errors in test_dags.py (#56735) (#56770)
Jonpaco23 commentedon Oct 20, 2025
Hello, first time contributer. Gonna give these a try:
api_fastapi/core_api/routes/ui/*vincbeck commentedon Oct 21, 2025
I updated the issue. 339 errors to go 🚀
Fix MyPy type errors in test_dags.py (apache#56735) (apache#56770)
sanju1198 commentedon Oct 23, 2025
Hi, first-time contributor. I'd like to try fixing the MyPy error in airflow/models/variable.py
vincbeck commentedon Oct 23, 2025
Please do :)
chiuinggum commentedon Oct 25, 2025
Hi, I'd like to fix
airflow-core/tests/unit/api_fastapi/core_api/routes/public/17 remaining items
vincbeck commentedon Nov 7, 2025
Issue updated
profgrammer commentedon Nov 8, 2025
Working on airflow-core/src/airflow/models/xcom.py
Seems like the previous piece I was working on is solved already.
KoviAnusha commentedon Nov 8, 2025
I was already working on this one (#57532)
profgrammer commentedon Nov 9, 2025
Working on airflow-core/src/airflow/api/common/delete_dag.py if it's still available.
profgrammer commentedon Nov 10, 2025
working on airflow-core/src/airflow/jobs/scheduler_job_runner.py
Srabasti commentedon Nov 13, 2025
While trying to understand the changes needed to replicate the issue, I see that the "How to Contribute" section 6 mentions "not" to include changes from #56212
This is contradicting with the section "How to reproduce" that says to "Apply changes from #56212 locally" as below.
Can someone please share the correct steps to replicate, since both these 2 different statements are contradicting each other?
Prab-27 commentedon Nov 13, 2025
@Srabasti ,
As I understand , This PR #56212 removes the SQLAlchemy 1 limit. After applying these changes, run:
breeze ci-image build --python 3.10 --upgrade-to-newer-dependenciesAt this stage, you're no longer using SQLAlchemy 1.x.
You’ll be able to reproduce the mypy errors introduced by that PR. Fix those errors here, and once resolved, you can remove the changes from that PR.
You're essentially fixing the mypy issues that came from that PR
If you’d like to discuss anything while working on this, there’s a Slack channel: #
fab-upgrade.arnoldmr01 commentedon Nov 18, 2025
Working on airflow-core/src/airflow/models
dag.py
dag_bag.py
KoviAnusha commentedon Nov 19, 2025
Sorry but I already have an open PR for that #57532
arnoldmr01 commentedon Nov 20, 2025
Will start working on airflow-core/src/airflow/models/
taskmap.py
serialized_dag.py
henry3260 commentedon Nov 20, 2025
I already work on taskmap.py in #57862 .
KoviAnusha commentedon Nov 22, 2025
I am already working on serialized_dag #58062
vincbeck commentedon Nov 24, 2025
Issue updated! 24 errors to go :)
vincbeck commentedon Jan 5, 2026
Completed