Andrushika opened a new pull request, #77522:
URL: https://github.com/apache/airflow/pull/77522

   ## Why
   
   Task SDK serde has a serializer for `V1Pod` and `V1ResourceRequirements`, 
and a generic serializer for pydantic models.
   
   #77168 upgraded the kubernetes client to 37. In client 37, these model 
classes are pydantic models.
   
   `serialize()` checks for a pydantic model before it looks for the serializer 
of the exact class. So the two classes skip the kubernetes serializer, and 
`test_encode_k8s_v1pod` fails on main.
   
   The client 37 type hints also make mypy report an `arg-type` error in the 
kubernetes serializer.
   
   ## What
   
   `serialize()` uses the serializer of the exact class before the generic 
pydantic serializer. `deserialize()` already uses this order.
   
   The kubernetes serializer calls `ApiClient().sanitize_for_serialization()`, 
which is all that `PodGenerator.serialize_pod` does. The serializer does not 
import the cncf.kubernetes provider, so it leaves the `check-core-imports` 
exclude list.
   
   Tested in breeze with kubernetes 36.0.3 and 37.0.1 (serde tests, mypy).
   
   related: #77168
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to