Viicos commented on PR #44249:
URL: https://github.com/apache/airflow/pull/44249#issuecomment-2493889097

   > Indeed this is not great. We have all the codebase updated to the new 
style type annotation. (`|`, `list`, etc...) and having to use the old one 
everywhere pydantic is involved is not great. (maybe I didn't understand 
correctly what you are suggesting).
   
   Yes sorry what I meant is precisely on the `LoggingMixin` class, where two 
annotations are using the old syntax, while the `_log` field is using the new 
one.
   
   But as you mentioned, nothing related to this should be an issue if the 
`eval-type-backport` backport is used. What's interesting however, is that the 
[initial report](https://github.com/pydantic/pydantic/issues/10924) should not 
happen if the backport is indeed installed.
   
   Turns out, the backport was added in 
https://github.com/apache/airflow/commit/7d5f2bad082425d0457e3f94e6119f739f3e9892,
 and the user is still on `2.9.0`, released prior to the addition of the 
dependency. Sorry for the confusion.
   
   ---
   
   > so It was more of a friendly advice than complaint.
   
   Sorry if I did not understand it that way. I think we both know how annoying 
unexpected breaking changes can be. In this case, the intent was to fix actual 
invalid cases (such as [this 
one](https://github.com/langchain-ai/langchain-google/issues/610)) and I would 
find it very unfortunate to consider Pydantic in the same state as other well 
established libraries (e.g. `requests`) where no change is possible because of 
https://xkcd.com/1172/.
   
   Regarding the "inconsistent use" we are talking about, as I answered at the 
top of this comment, it was in fact due to the reporting user not using the 
latest airfow version which included the evaluation backport.
   
   > while Pydantic does not really handle them properly
   
   Pydantic is not really to blame here. There are some PEP 563 use cases that 
are _theoretically impossible_ to support (e.g. referencing locals in a 
function) (and we had/will have to wait for PEP 649 to resolve most of these 
cases). And compared to the other dataclass-like libraries performing 
validation, I'm not afraid to say Pydantic is by far the most accurate when it 
comes to handling forward annotations, including the `eval-type-backport` 
library (which solves most of the discussion here :smile:).
   
   Thanks again, I'll close the original issue by suggesting upgrading to the 
latest airflow version. Please let us know if you encounter more issues with 
2.10.1.


-- 
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