Lee-W commented on code in PR #77529:
URL: https://github.com/apache/airflow/pull/77529#discussion_r4678837014
##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/dag_parsing.py:
##########
@@ -463,7 +463,7 @@ class _CallbackWork:
model = DagProcessorCallback
kind: Literal["callbacks", "priority"] = "callbacks"
- def build_query(self, *, replaying: bool) ->
Select[tuple[DagProcessorCallback]]:
+ def build_query(self, *, replaying: bool) -> Select[DagProcessorCallback]:
Review Comment:
On SQLAlchemy 2.0.57, which uv.lock pins for Python < 3.14, a local
`mypy-airflow-core` run reports two new `[return-value]` errors in
`_CallbackWork.build_query and _PriorityWork.build_query` (got
"Select[tuple[DagProcessorCallback]]", expected
"`Select[DagProcessorCallback]`"); the base has none there.
This can be reproduced by `UV_PYTHON=3.12.11 prek run mypy-airflow-core
--all-files`
```
warning:
`VIRTUAL_ENV=/Users/weilee/.cache/prek/hooks/python-efRqj5YSS86gXxe1MBa8` does
not match the project environment path `.build/mypy-venvs/airflow-core` and
will be ignored; use `--active` to target the active environment instead
airflow-core/src/airflow/api_fastapi/execution_api/routes/dag_parsing.py:470:
error:
Incompatible return value type (got
"Select[tuple[DagProcessorCallback]]",
expected "Select[DagProcessorCallback]") [return-value]
return query
^~~~~
airflow-core/src/airflow/api_fastapi/execution_api/routes/dag_parsing.py:490:
error:
Incompatible return value type (got
"Select[tuple[DagPriorityParsingRequest]]",
expected "Select[DagPriorityParsingRequest]") [return-value]
return select(self.model).order_by(self.model.id)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 2 errors in 1 file (checked 1380 source files)
Mypy check failed. You can run mypy locally with:
prek run mypy-airflow-core --all-files
The hook uses dedicated virtualenv(s) and mypy cache(s) under .build/ so
it does
not touch your regular project .venv. You can clear both with:
breeze down --cleanup-mypy-cache
```
The variadic spelling only passes on 2.1, so could these three return types
be a bare Select with a TODO, like UUIDSelect in airflow/utils/sqlalchemy.py
(see #74629)? Could the description also say which SQLAlchemy and Python
versions the 15 errors were measured on?
--
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]