You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Andrushika (via GitHub)" <gi...@apache.org> on 2026/09/24 09:25:52 UTC
[PR] Fix mypy error in common.ai decision helper with pydantic-ai 2.46 [airflow]
Andrushika opened a new pull request, #73652:
URL: https://github.com/apache/airflow/pull/73652
## Why
`_choice_types()` in `providers/common/ai/.../utils/decision.py` imports `Choice` and `Choices` from pydantic-ai on first use, and falls back to `None` on versions before 2.46.0. pydantic-ai-slim 2.46.0 adds both names, so mypy now types the imported aliases as those classes and rejects the `None` fallback. The CI environment upgrade in #73629 bumps pydantic-ai-slim to 2.46.0, and its providers mypy check fails with 3 errors on this line.
## What
Assign the `None` fallback to the module globals in `except`, and copy the imported types in `else`, so runtime behaviour does not change. CI on this PR still uses 2.44.0 and passes with or without the change, so I checked with mypy on `providers/common/ai` in breeze: the old code fails on 2.46.0, and this change passes on both 2.44.0 and 2.46.0.
related: #73629
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Claude Code (Opus 5.5)
Generated-by: Claude Code (Opus 5.5) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix mypy error in common.ai decision helper with pydantic-ai 2.46 [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #73652:
URL: https://github.com/apache/airflow/pull/73652#issuecomment-5812041738
Also thanks!
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix mypy error in common.ai decision helper with pydantic-ai 2.46 [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #73652:
URL: https://github.com/apache/airflow/pull/73652
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org