Skip to content

Update dependencies#285

Merged
julianstirling merged 4 commits intomainfrom
update-dependencies
Mar 5, 2026
Merged

Update dependencies#285
julianstirling merged 4 commits intomainfrom
update-dependencies

Conversation

@rwb27
Copy link
Collaborator

@rwb27 rwb27 commented Mar 5, 2026

This PR updates our dependencies, in particular we now specify pydantic ~= 2.12 and fastapi >=0.135.

This required a few fixes:

  • We no longer get a SchemaError if bad constraints are specified, instead it's a RuntimeError. I've updated error checking code accordingly. No need to support the old behaviour, as we now require a newer pydantic.
  • I use a different attribute to get the schema of BlobModel when generating the schema for Blob, 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 fastapi or uvicorn and 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.

rwb27 added 3 commits March 5, 2026 00:11
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
Copy link

barecheck bot commented Mar 5, 2026

Barecheck - Code coverage report

Total: 96.34%

Your code coverage diff: -0.01% ▾

Uncovered files and lines
FileLines
src/labthings_fastapi/outputs/blob.py301, 904-905
src/labthings_fastapi/utilities/__init__.py137, 153

@julianstirling
Copy link
Contributor

Worth firing up a server and checking it works as expected as this is quite a major fastapi change. But It would be good to get this in

Co-authored-by: Julian Stirling <julian@julianstirling.co.uk>
@rwb27
Copy link
Collaborator Author

rwb27 commented Mar 5, 2026

Worth firing up a server and checking it works as expected as this is quite a major fastapi change. But It would be good to get this in

I see we've both done that. I think we're good to merge?

Copy link
Contributor

@julianstirling julianstirling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this on the Simulation server. I'm happy it works. It feels faster more responsive, but that may be placebo!

@julianstirling julianstirling merged commit 468c4ec into main Mar 5, 2026
14 of 15 checks passed
@julianstirling julianstirling deleted the update-dependencies branch March 5, 2026 12:47
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