potiuk commented on PR #44249: URL: https://github.com/apache/airflow/pull/44249#issuecomment-2493571703
> If we do get more reports, depending on their validity, we will then consider tweaking the current logic. Sure. It is indeed up to you. We are pretty well protected - we have "constraint mechanism" and we can restric airlfow 2.10.4 - and we are rather happy to adjust future versions of airflow, I was just merely suggesting that this change might have more consequences for you - so It was more of a friendly advice than complaint. But yes - I agree my assesment might be wrong. > Your usage of type annotations is inconsistent here, as you are mixing the new union syntax with Optional. Note that if this class were to be defined in the same module as [TaskInstancePydantic](https://github.com/apache/airflow/blob/1307e37bc6338c43aa5099752d012e244f8494ba/airflow/serialization/pydantic/taskinstance.py#L84), the issue would have appeared already. Yes - but to be perfectly honest it's because of Pydantic. We have a rule in our pre-commit that enforces using new style type annotations. Because of inability of pydantic to handle it, we specifically converted our Pydantic classes to not use `from future import __annotations__` and we even had to add exeption to our rule: https://github.com/apache/airflow/blob/main/pyproject.toml#L326 So our "inconistent use" is exclusively because of Pydantic. And our use is perfectly fine according to current state of type annotations - both style of annotations can be inter-mixed and `from __future__ import annoutattion` as defined in https://peps.python.org/pep-0563/ . And while I know there are a lot of controversies around that PEP and the way how it works will likely change in the future, this is the current state of affairs, and we are following the accepted PEPs (while Pydantic does not really handle them properly and we had to introduce inconsistency in order to workaround it). So technically speaking it's because of Pydantic we are inconsistent. And I am not complaining and not trying to heat it up, I am just stating the fact - explaining that well, it's Pydantic who is the root cause of that inconsistency, not Airflow. So really - @Viicos - please treat it as a friendly advice, that maybe it's a good idea to consider supporting that case. While we will handle it ourselves (luckily our constraint mechanism we introduce many years ago and educate our users to use them will prevent a lot of our users from being affected). It's really a maintainer-to-maintainer friendly suggestion that this might hit you back. -- 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]
