-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Replace pydantic with mashumaro #740
Conversation
I'd definitely say make each of these changes into separate PRs for each change mentioned (CI fixes, async timeout, grammar/spelling fixes, linting fixes, etc) |
I moved the unrelated changes to get the pipelines to run to other PRs:
Those can be made first and I'll rebase this branch once that is done. I left safety dependency removal in this PR because it's required to be removed for pydantic to be completely dropped. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, for your work on this @bvanelli 👍
I've merged all split out PRs, and went over the project in certain places myself as well. CI on the main branch now passes again.
Can you rebase this PR on top of the latest main
branch?
Thanks! 👍
../Frenck
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #740 +/- ##
==========================================
+ Coverage 93.73% 94.50% +0.76%
==========================================
Files 6 6
Lines 383 400 +17
Branches 35 23 -12
==========================================
+ Hits 359 378 +19
+ Misses 22 17 -5
- Partials 2 5 +3 ☔ View full report in Codecov by Sentry. |
@frenck did the rebase, everything looks nice except the poetry file that has some references to my own environent after running Let me know if I should change something else 👍 |
Thanks, @bvanelli! 👍 I will take a look... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the last change in place, it would only omit |
Yes, that is correct, I did that based on the docs request, and there it does not seem clear to me that those sub-fields are optional, for example, for
Fields from the I did not move to review again since there is another issue. It seems like |
Never mind, I just realized I used the wrong validation, I should have used dataclasses |
@frenck Thanks for reviewing and noticing my mistake on the serialization. I have changed the Regarding the omit optional fields, I have not changed the behaviour for the inner objects. Since you have more experience with the API, should that be the case? That is affectin:
and from what I understood from the documentation none of them are option. |
Awesome 👍 Just tested it against real devices, it seems to work as expected 👍 Will push up some nitpick sorting we can do now and continue on merging this one in. ../Frenck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @bvanelli 👍
../Frenck
Proposed Changes
This PR exchanges the pydantic dependency with mashumaro. This is due to the fact that the version of pydantic used is not anymore supported, and a migration was not accepted (see #531)
I've taken into account the following PRs from the author as references on how to do the migration:
Changelog
I had to to some unrelated changes to get the pipeline to run through, due to some library upgrades that now fail on CI. Since the content is not crazy big, I decided to add them to the same PR, but let me know if I should make a separate PR instead. Here is the list of changes:
Discussion
As far as tests are concerned, the changes should work out of the box, but I do not have one of those devices to test it. If there is a way to have simulated APIs or there are test cases that should be covered, let me know.
Related Issues
For the pydantic upgrade in HA, this change is necessary: