Open
Conversation
This forces an update of `pydantic` which skips over an upstream bug.
I was extracting the schema from a model using the now-deprecated `__get_pydantic_core_schema__`. It turns out there's a much simpler way, which is the `__pydantic_core_schema__` property that doesn't raise a warning. I have switched to this, and gotten rid of my deprecation warnings.
As I've upped the minimum pydantic version anyway, there's no need to support two versions - I've just updated the code to check for a `RuntimeError` instead of a `SchemaError`. I've also updated my test case, which no longer causes Pydantic to fail - I've found another combination that does cause the same error, and we now use that.
Barecheck - Code coverage reportTotal: 96.3%Your code coverage diff: -0.01% ▾ Uncovered files and lines
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates our dependencies, in particular we now specify
pydantic ~= 2.12andfastapi >=0.135.This required a few fixes:
SchemaErrorif bad constraints are specified, instead it's aRuntimeError. I've updated error checking code accordingly. No need to support the old behaviour, as we now require a newerpydantic.BlobModelwhen generating the schema forBlob, due to a deprecation warning.The only remaining warning I get in tests is a deprecation warning about websockets. I think this must be the fault of
fastapioruvicornand I've not gotten to the bottom of it. However, this is not a new warning - it happened before the updates as well.Edit: this does not answer #283 as that will only be fixed once Pydantic 2.13 is released. It may still be worth merging, as the fixes here will be needed when we upgrade to pydantic 2.13.