-
Couldn't load subscription status.
- Fork 3
Fix various warnings from pydantic >= 2.10 #29
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #29 +/- ##
===========================================
- Coverage 94.64% 50.69% -43.95%
===========================================
Files 8 8
Lines 280 286 +6
===========================================
- Hits 265 145 -120
- Misses 15 141 +126 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Otherwise we get: ``` pydantic.warnings.PydanticDeprecatedSince211: Accessing the 'model_fields' attribute on the instance is deprecated. Instead, you should access this attribute from the model class. Deprecated in Pydantic V2.11 to be removed in V3.0. ```
https://docs.pydantic.dev/latest/concepts/validators/#model-validators says that "after" model validators are instance methods and should return the validated instance. The previous test code produced a warning from pydantic >= 2.9.0: ``` UserWarning: A custom validator is returning a value other than `self`. Returning anything other than `self` from a top level model validator isn't supported when validating via `__init__`. See the `model_validator` docs (https://docs.pydantic.dev/latest/concepts/validators/#model-validators) for more details. ```
694a688 to
d1fc024
Compare
|
My last commit here is for pydantic 2.12.0a1, but it's broken on some earlier versions and I don't quite know how to fix it. pydantic 1 requires model validators to have Do you have any bright ideas? |
|
thanks @cjwatson. If you primarily want this for pyapp-kit/app-model#235, then I agree with you over there that just dropping pydantic1 is the right approach, (see pyapp-kit/app-model#263) this repo should be largely considered in maintenance mode... so one possibility here, if we just want to get tests passing, is to not be so strict about tests warnings and remove this line: pydantic-compat/pyproject.toml Line 116 in 103f757
alternatively, can you tell me more about the exact failures in Debian's CI? |
|
The only thing that depends on pydantic-compat in Debian is app-model. If that drops its dependency, then we can just drop pydantic-compat - I don't think Debian has any particular interest in it for its own sake. The failures are visible in e.g. https://ci.debian.net/packages/p/pydantic-compat/testing/amd64/64021592/ if you're interested. |
|
FWIW, we removed this package from Debian (after Debian 13). |
|
Thanks! Seems reasonable to me 👍 |
These caused failures in Debian's CI.