Skip to content

Commit 468c4ec

Browse files
Merge pull request #285 from labthings/update-dependencies
Update dependencies
2 parents 48c48b2 + 6d815c4 commit 468c4ec

File tree

5 files changed

+20
-28
lines changed

5 files changed

+20
-28
lines changed

dev-requirements.txt

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# uv pip compile --extra dev pyproject.toml --output-file dev-requirements.txt
33
alabaster==1.0.0
44
# via sphinx
5+
annotated-doc==0.0.4
6+
# via fastapi
57
annotated-types==0.7.0
68
# via pydantic
79
anyio==4.9.0
@@ -45,12 +47,6 @@ click==8.2.1
4547
# uvicorn
4648
codespell==2.4.1
4749
# via labthings-fastapi (pyproject.toml)
48-
colorama==0.4.6
49-
# via
50-
# click
51-
# pytest
52-
# sphinx
53-
# uvicorn
5450
coverage==7.9.2
5551
# via pytest-cov
5652
cssutils==2.11.1
@@ -83,7 +79,7 @@ exceptiongroup==1.3.0
8379
# via
8480
# anyio
8581
# pytest
86-
fastapi==0.116.1
82+
fastapi==0.135.1
8783
# via labthings-fastapi (pyproject.toml)
8884
fastapi-cli==0.0.8
8985
# via fastapi
@@ -169,8 +165,6 @@ natsort==8.4.0
169165
# via domdf-python-tools
170166
numpy==2.2.6
171167
# via labthings-fastapi (pyproject.toml)
172-
orjson==3.11.0
173-
# via fastapi
174168
packaging==25.0
175169
# via
176170
# pytest
@@ -187,14 +181,14 @@ pluggy==1.6.0
187181
# pytest-cov
188182
pycodestyle==2.14.0
189183
# via flake8
190-
pydantic==2.10.6
184+
pydantic==2.12.5
191185
# via
192186
# labthings-fastapi (pyproject.toml)
193187
# fastapi
194188
# fastapi-cloud-cli
195189
# pydantic-extra-types
196190
# pydantic-settings
197-
pydantic-core==2.27.2
191+
pydantic-core==2.41.5
198192
# via pydantic
199193
pydantic-extra-types==2.10.5
200194
# via fastapi
@@ -355,10 +349,11 @@ typing-extensions==4.14.1
355349
# typer
356350
# typing-inspection
357351
# uvicorn
358-
typing-inspection==0.4.1
359-
# via pydantic-settings
360-
ujson==5.10.0
361-
# via fastapi
352+
typing-inspection==0.4.2
353+
# via
354+
# fastapi
355+
# pydantic
356+
# pydantic-settings
362357
urllib3==2.5.0
363358
# via
364359
# requests
@@ -369,6 +364,8 @@ uvicorn==0.35.0
369364
# fastapi
370365
# fastapi-cli
371366
# fastapi-cloud-cli
367+
uvloop==0.22.1
368+
# via uvicorn
372369
watchfiles==1.1.0
373370
# via uvicorn
374371
webencodings==0.5.1

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ classifiers = [
1313
"Operating System :: OS Independent",
1414
]
1515
dependencies = [
16-
"pydantic ~= 2.10.6",
16+
"pydantic ~= 2.12",
1717
"numpy>=1.20",
1818
"jsonschema",
1919
"typing_extensions",
2020
"anyio ~=4.0",
2121
"httpx",
22-
"fastapi[all]>=0.115.0",
22+
"fastapi[all]~=0.135.0",
2323
"zeroconf >=0.28.0",
2424
]
2525

src/labthings_fastapi/outputs/blob.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ def __get_pydantic_core_schema__(
614614
"""
615615
return core_schema.no_info_wrap_validator_function(
616616
cls._validate,
617-
BlobModel.__get_pydantic_core_schema__(BlobModel, handler),
617+
BlobModel.__pydantic_core_schema__,
618618
serialization=core_schema.wrap_serializer_function_ser_schema(
619619
cls._serialize,
620620
is_field_serializer=False,

src/labthings_fastapi/utilities/__init__.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from weakref import WeakSet
77
from pydantic import BaseModel, ConfigDict, Field, RootModel, create_model
88
from pydantic.dataclasses import dataclass
9-
from pydantic_core import SchemaError
109

1110
from labthings_fastapi.exceptions import UnsupportedConstraintError
1211
from .introspection import EmptyObject
@@ -129,7 +128,7 @@ def wrap_plain_types_in_rootmodel(
129128
:raises UnsupportedConstraintError: if constraints are provided for an
130129
unsuitable type, for example `allow_inf_nan` for an `int` property, or
131130
any constraints for a `BaseModel` subclass.
132-
:raises SchemaError: if other errors prevent Pydantic from creating a schema
131+
:raises RuntimeError: if other errors prevent Pydantic from creating a schema
133132
for the generated model.
134133
"""
135134
try: # This needs to be a `try` as basic types are not classes
@@ -148,13 +147,9 @@ def wrap_plain_types_in_rootmodel(
148147
root=(model, Field(**constraints)),
149148
__base__=LabThingsRootModelWrapper,
150149
)
151-
except SchemaError as e:
152-
for error in e.errors():
153-
if error["loc"][-1] in constraints:
154-
key = error["loc"][-1]
155-
raise UnsupportedConstraintError(
156-
f"Constraint {key} is not supported for type {model!r}."
157-
) from e
150+
except RuntimeError as e:
151+
if "Unable to apply constraint" in str(e):
152+
raise UnsupportedConstraintError(str(e)) from e
158153
raise e
159154

160155

tests/test_properties.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ def test_bad_property_constraints():
438438
"""Test that bad constraints raise errors at definition time."""
439439

440440
class BadConstraintThing(lt.Thing):
441-
bad_prop: int = lt.property(default=0, allow_inf_nan=False)
441+
bad_prop: str = lt.property(default="hello", allow_inf_nan=True)
442442

443443
# Some constraints cause errors when the model is built. So far
444444
# I believe only allow_inf_nan on int does this.

0 commit comments

Comments
 (0)