-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Re-create PR for Enable Serde for Pydantic BaseModel and Subclasses #52360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I applied "full tests needed" and resolved conflict with Python 3.9 removal to trigger the build |
5164de8 to
8d4d944
Compare
8d4d944 to
c79af1f
Compare
|
REbased again - we had some microsoft kiota new version released that broke main |
c79af1f to
85f95a7
Compare
|
Hi @bolkedebruin , @potiuk , @amoghrajesh , I would appreciate if I could get your help again to review this PR. I also wanted to share some findings while doing testing. Issue with serializing
|
b667619 to
1076e4d
Compare
|
after rebase, the following issue related to the
|
1076e4d to
2b90db5
Compare
|
I accidentally made a mistake when rebasing the branch.. I ran a |
Hehe been there, done that :D. Luckily git is very forgiving and |
resolve conflicts in test case
need to overwrite if classname == qualname(datetime.timedelta) and isinstance(data, str | float) since the second argument of isinstance accept a class or tuple resolve conflict
resolve conflict
181b827 to
c4d8274
Compare
|
I rebased it also with "all versions" - just to be sure - this also runs all the same matrix of tests as the canary build |
Yeah, agree, and thanks a lot! |







The chage in #51059 broke canary tests in https://github.com/apache/airflow/actions/runs/15910813471/job/44877861492. The PR is reverted through #52312.
Create this PR to fix the issue.
The issue in #51059
First, the refactored
deserializetake the actual class instead of classname. Therefore, the following test case is modified from"zi = deserialize("backports.zoneinfo.ZoneInfo", 1, "Asia/Taipei")"tozi = deserialize(ZoneInfo, 1, "Asia/Taipei"). I think the "backports.zoneinfo.ZoneInfo" is a backport of the standard library modulezoneinfoin Python 3.9, to suppor lower version of Python.In the
airflow-core/src/airflow/serialization/serializers/timezone.py, the line below is looking for the backport ZoneInfo, instead of the standard libraryzoneinfo. Therefore, when aZoneInfoclass is passed into thedeserialize, thequalname(cls)is resolved to "zoneinfo.ZoneInfo" instead of "backports.zoneinfo.ZoneInfo". Therefore, the data will be deserialized throughparse_timezone(data), resulting in a different object. Therefore the test case failed.Solution
To resolve this issue, I updated the if condition to
if cls is ZoneInfo and isinstance(data, str):. I think the minimum version of Python we support is 3.9. So, "backports.zoneinfo.ZoneInfo" should probably be removed.After making the changes, I ran the following tests and all checks passed.
breeze --python 3.9 testing core-tests --test-type Serializationbreeze --python 3.9 testing core-tests --test-type Serialization --downgrade-pendulumbreeze --python 3.10 testing core-tests --test-type Serialization
breeze --python 3.10 testing core-tests --test-type Serialization --downgrade-pendulum
breeze --python 3.11 testing core-tests --test-type Serialization
breeze --python 3.11 testing core-tests --test-type Serialization --downgrade-pendulum
but I got some container issues when running for 3.12. Will look into the full test results and action accordingly.
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.