vincbeck opened a new issue, #56735: URL: https://github.com/apache/airflow/issues/56735
### 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 https://github.com/apache/airflow/pull/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-files` reveals 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 ## Error Breakdown by Directory ### models (167 errors in 23 files) - [ ] dagrun.py (53 errors) - [ ] taskinstance.py (39 errors) - [ ] dag.py (10 errors) - [ ] trigger.py (9 errors) - [ ] serialized_dag.py (7 errors) - [ ] deadline.py (6 errors) - [ ] taskreschedule.py (5 errors) - [ ] taskmap.py (4 errors) - [ ] xcom.py (4 errors) - [ ] variable.py (4 errors) - [ ] hitl.py (3 errors) - [ ] hitl_history.py (3 errors) - [ ] backfill.py (3 errors) - [ ] pool.py (3 errors) - [ ] connection.py (3 errors) - [ ] db_callback_request.py (2 errors) - [ ] dagbag.py (2 errors) - [ ] errors.py (2 errors) - [ ] log.py (1 errors) - [ ] dag_version.py (1 errors) - [ ] renderedtifields.py (1 errors) - [ ] dagbundle.py (1 errors) - [ ] taskinstancehistory.py (1 errors) ### api_fastapi/core_api/routes/public (67 errors in 15 files) - [ ] dag_run.py (21 errors) - [ ] task_instances.py (21 errors) - [ ] assets.py (6 errors) - [ ] dags.py (4 errors) - [ ] connections.py (2 errors) - [ ] variables.py (2 errors) - [ ] pools.py (2 errors) - [ ] backfills.py (2 errors) - [ ] event_logs.py (1 errors) - [ ] dag_warning.py (1 errors) - [ ] dag_versions.py (1 errors) - [ ] import_error.py (1 errors) - [ ] job.py (1 errors) - [ ] xcom.py (1 errors) - [ ] hitl.py (1 errors) ### jobs (54 errors in 3 files) - [ ] scheduler_job_runner.py (34 errors) - [ ] job.py (19 errors) - [ ] base_job_runner.py (1 errors) ### utils (36 errors in 7 files) - [ ] db.py (21 errors) - [ ] sqlalchemy.py (6 errors) - [ ] db_cleanup.py (5 errors) - [ ] session.py (1 errors) - [ ] cli_action_loggers.py (1 errors) - [ ] context.py (1 errors) - [ ] dot_renderer.py (1 errors) ### api_fastapi/execution_api/routes (31 errors in 5 files) - [ ] task_instances.py (18 errors) - [ ] hitl.py (9 errors) - [ ] asset_events.py (2 errors) - [ ] task_reschedules.py (1 errors) - [ ] dag_runs.py (1 errors) ### dag_processing (20 errors in 3 files) - [ ] collection.py (12 errors) - [ ] manager.py (6 errors) - [ ] dagbag.py (2 errors) ### api_fastapi/core_api/routes/ui (18 errors in 6 files) - [ ] dashboard.py (13 errors) - [ ] assets.py (1 errors) - [ ] structure.py (1 errors) - [ ] backfills.py (1 errors) - [ ] dags.py (1 errors) - [ ] grid.py (1 errors) ### tests/unit/models (21 errors in 3 files) - [ ] test_pool.py (7 errors) - [ ] test_variable.py (7 errors) - [ ] test_connection.py (7 errors) ### tests/unit/api_fastapi/core_api/routes/public (12 errors in 3 files) - [ ] test_dag_run.py (9 errors) - [ ] test_hitl.py (2 errors) - [ ] test_assets.py (1 errors) ### api_fastapi/core_api (11 errors in 2 files) - [ ] security.py (9 errors) - [ ] app.py (2 errors) ### ti_deps/deps (11 errors in 2 files) - [ ] trigger_rule_dep.py (6 errors) - [ ] prev_dagrun_dep.py (5 errors) ### cli/commands (10 errors in 2 files) - [ ] dag_command.py (7 errors) - [ ] task_command.py (3 errors) ### api_fastapi/common (9 errors in 1 files) - [ ] parameters.py (9 errors) ### api/common (7 errors in 2 files) - [ ] mark_tasks.py (6 errors) - [ ] delete_dag.py (1 errors) ### serialization (7 errors in 1 files) - [ ] serialized_objects.py (7 errors) ### tests/integration/otel (6 errors in 1 files) - [ ] test_otel.py (6 errors) ### root (5 errors in 1 files) - [ ] settings.py (5 errors) ### api_fastapi/core_api/services/public (5 errors in 4 files) - [ ] dag_run.py (2 errors) - [ ] connections.py (1 errors) - [ ] variables.py (1 errors) - [ ] pools.py (1 errors) ### api_fastapi/core_api/services/ui (5 errors in 1 files) - [ ] calendar.py (5 errors) ### utils/log (4 errors in 2 files) - [ ] file_task_handler.py (2 errors) - [ ] log_reader.py (2 errors) ### api_fastapi/common/db (3 errors in 2 files) - [ ] common.py (2 errors) - [ ] dag_runs.py (1 errors) ### tests/unit/api_fastapi/core_api/routes/ui (3 errors in 1 files) - [ ] test_dags.py (3 errors) ### api_fastapi/execution_api/datamodels (2 errors in 1 files) - [ ] hitl.py (2 errors) ### tests/unit/api/common (2 errors in 1 files) - [ ] test_mark_tasks.py (2 errors) ### tests/unit/api_fastapi/common (2 errors in 1 files) - [ ] test_exceptions.py (2 errors) ### executors (1 errors in 1 files) - [ ] workloads.py (1 errors) ### cli (1 errors in 1 files) - [ ] utils.py (1 errors) ### assets (1 errors in 1 files) - [ ] manager.py (1 errors) ### api_fastapi/logging (1 errors in 1 files) - [ ] decorators.py (1 errors) ### tests/unit/ti_deps/deps (1 errors in 1 files) - [ ] test_mapped_task_upstream_dep.py (1 errors) ### tests/unit/serialization (1 errors in 1 files) - [ ] test_serialized_objects.py (1 errors) ### tests/unit/utils (1 errors in 1 files) - [ ] test_helpers.py (1 errors) ## How to Contribute 1. **Pick a file**: Choose an unchecked file from the list above 2. **Check the box**: Update this issue to mark the file as being worked on 3. **Run MyPy locally**: `prek --color always --verbose --hook-stage manual "mypy-airflow-core" <file/directory>` 4. **Fix the errors**: Address the type errors in your chosen file 5. **Test your changes**: Ensure tests still pass 6. **Submit a PR**: Create a pull request with your fixes. Please do not include in your PR changes from https://github.com/apache/airflow/pull/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 https://github.com/apache/airflow/pull/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-files` reveals 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 - [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
