Skip to content

Conversation

@cjwatson
Copy link

@cjwatson cjwatson commented Sep 2, 2025

These caused failures in Debian's CI.

@codecov
Copy link

codecov bot commented Sep 2, 2025

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.69%. Comparing base (103f757) to head (d1fc024).

Files with missing lines Patch % Lines
src/pydantic_compat/_v1/__init__.py 0.00% 1 Missing ⚠️
src/pydantic_compat/_v2/mixin.py 75.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (103f757) and HEAD (d1fc024). Click for more details.

HEAD has 467 uploads less than BASE
Flag BASE (103f757) HEAD (d1fc024)
472 5
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.
```
@cjwatson
Copy link
Author

cjwatson commented Sep 2, 2025

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 cls as their first parameter. pydantic >= 2.9 documents that model validators should return self, and raises a warning if they don't. pydantic >= 2.12.0a1 stops automatically converting "after" validators to class methods (pydantic/pydantic#11957). The combination of all these things makes it difficult to see how to retain compatibility with all versions.

Do you have any bright ideas?

@tlambert03
Copy link
Member

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:

filterwarnings = ["error"]

alternatively, can you tell me more about the exact failures in Debian's CI?

@cjwatson
Copy link
Author

cjwatson commented Sep 2, 2025

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.

@cjwatson
Copy link
Author

FWIW, we removed this package from Debian (after Debian 13).

@tlambert03
Copy link
Member

Thanks! Seems reasonable to me 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants