-
Notifications
You must be signed in to change notification settings - Fork 14
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
DM-39876: Add bandaid for pydantic v2 #859
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #859 +/- ##
==========================================
+ Coverage 87.89% 87.90% +0.01%
==========================================
Files 270 270
Lines 35544 35589 +45
Branches 7452 7452
==========================================
+ Hits 31241 31286 +45
Misses 3145 3145
Partials 1158 1158
☔ View full report in Codecov by Sentry. |
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.
Looks good, one minor question.
funcName: str | None | ||
funcName: str | None = None | ||
process: int | ||
processName: str | ||
exc_info: str | None | ||
exc_info: str | None = None | ||
MDC: dict[str, str] |
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.
Does this work with v1? I thought that pydantic (v1) does not allow non-default attributes after default ones (but I may be thinking of dataclasses)?
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.
I made that change first with the auto updater and it seemed to be okay. I am running Jenkins over night on everything so I'll see whether everything works in the morning.
pydantic v2 is not compatible with daf_butler at the moment. Change all the imports to first try to load the v1 API explicitly before falling back to the default API. pydantic.v1 works with v2.
I'm not sure what to do about the mypy failures. Mypy doesn't know about pydantic.v1 and with pydantic v1 it complains about thta type not existing because it never falls back to the except block. With pydantic v2 installed it gets even more confused. |
<3 to protect us against the v3 breakage.
In theory changing mypy.ini to use |
This will only work in pydantic v2 with mypy but typing with pydantic is already broken with v1 with the changes on this branch.
Pydantic v2 breaks everything. Rather than pinning to <2 instead use the facility provided by v2 to import v1 APIs. This will give us some flexibility on timeline for fixing things to work only with v2.
Checklist
doc/changes