-
Notifications
You must be signed in to change notification settings - Fork 66
fix: don't pass extra to BaseModel.model_validate #772
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
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/kleinanzeigen_bot/utils/pydantics.py (1)
29-30: Fixby_nameparameter compatibility with supported Pydantic versions.The
by_nameparameter was added in Pydantic v2.11, but the project supportspydantic>=2.0.0(including versions 2.0–2.10). Passingby_nameunconditionally tosuper().model_validate()on line 47 will raise aTypeErrorat runtime on any Pydantic version before 2.11.The same issue applies to line 46 if
by_aliaswas added after v2.0. Consider either:
- Requiring Pydantic ≥2.11 in
pyproject.toml, or- Adding version checks before passing these parameters
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #772 +/- ##
=======================================
Coverage 88.58% 88.58%
=======================================
Files 20 20
Lines 2172 2173 +1
Branches 423 423
=======================================
+ Hits 1924 1925 +1
Misses 120 120
Partials 128 128
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
## ℹ️ Description Raise Pydantic version cause we use features that require at least v2.11. - Link to the related issue(s): PR #772 ## 📋 Changes Summary - Set min version to v2.11 ### ⚙️ Type of Change Select the type(s) of change(s) included in this pull request: - [x] 🐞 Bug fix (non-breaking change which fixes an issue) ## ✅ Checklist Before requesting a review, confirm the following: - [x] I have reviewed my changes to ensure they meet the project's standards. - [x] I have tested my changes and ensured that all tests pass (`pdm run test`). - [x] I have formatted the code (`pdm run format`). - [x] I have verified that linting passes (`pdm run lint`). - [x] I have updated documentation where necessary. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated project dependencies to improve compatibility and stability. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
ℹ️ Description
Fixes a crash when loading configs on Pydantic v2 by not forwarding the unsupported call-time argument extra to
BaseModel.model_validate().
with TypeError: BaseModel.model_validate() got an unexpected keyword argument 'extra'. The wrapper
ContextualModel.model_validate() accepted extra and forwarded it, which is not supported in Pydantic v2. This PR
keeps the argument for compatibility but ignores it and documents the behavior.
Changes Summary
⚙️ Type of Change
✅ Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under
the terms of your choice.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.