Skip to content

Commit e246ad6

Browse files
authored
Upgrade Pydantic to v2.12.0 and remove hack for Python 3.13 (#26481)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
1 parent 5728da1 commit e246ad6

File tree

5 files changed

+8
-18
lines changed

5 files changed

+8
-18
lines changed

requirements/common.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ protobuf # Required by LlamaTokenizer.
1313
fastapi[standard] >= 0.115.0 # Required by FastAPI's form models in the OpenAI API server's audio transcriptions endpoint.
1414
aiohttp
1515
openai >= 1.99.1 # For Responses API with reasoning content
16-
pydantic >= 2.11.7
16+
pydantic >= 2.12.0
1717
prometheus_client >= 0.18.0
1818
pillow # Required for image processing
1919
prometheus-fastapi-instrumentator >= 7.0.0

requirements/nightly_torch_test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ numba == 0.61.2 # Required for N-gram speculative decoding
4444
numpy
4545
runai-model-streamer[s3,gcs]==0.14.0
4646
fastsafetensors>=0.1.10
47-
pydantic>=2.10 # 2.9 leads to error on python 3.10
47+
pydantic>=2.12 # 2.11 leads to error on python 3.13

requirements/test.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ numba == 0.61.2 # Required for N-gram speculative decoding
5252
numpy
5353
runai-model-streamer[s3,gcs]==0.14.0
5454
fastsafetensors>=0.1.10
55-
pydantic>=2.10 # 2.9 leads to error on python 3.10
55+
pydantic>=2.12 # 2.11 leads to error on python 3.13
5656
decord==0.6.0
5757
terratorch @ git+https://github.com/IBM/terratorch.git@1.1.rc3 # required for PrithviMAE test
5858
gpt-oss >= 0.0.7; python_version > '3.11'

requirements/test.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ pycparser==2.22
783783
# via cffi
784784
pycryptodomex==3.22.0
785785
# via blobfile
786-
pydantic==2.11.7
786+
pydantic==2.12.0
787787
# via
788788
# -r requirements/test.in
789789
# albumentations
@@ -797,7 +797,7 @@ pydantic==2.11.7
797797
# openai-harmony
798798
# pydantic-extra-types
799799
# ray
800-
pydantic-core==2.33.2
800+
pydantic-core==2.41.1
801801
# via pydantic
802802
pydantic-extra-types==2.10.5
803803
# via mistral-common
@@ -1224,7 +1224,7 @@ types-python-dateutil==2.9.0.20241206
12241224
# via arrow
12251225
typeshed-client==2.8.2
12261226
# via jsonargparse
1227-
typing-extensions==4.12.2
1227+
typing-extensions==4.15.0
12281228
# via
12291229
# aiosignal
12301230
# albumentations
@@ -1253,7 +1253,7 @@ typing-extensions==4.12.2
12531253
# typer
12541254
# typeshed-client
12551255
# typing-inspection
1256-
typing-inspection==0.4.1
1256+
typing-inspection==0.4.2
12571257
# via pydantic
12581258
tzdata==2024.2
12591259
# via pandas

vllm/config/utils.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,7 @@ def get_attr_docs(cls: type[Any]) -> dict[str, str]:
111111
https://davidism.com/mit-license/
112112
"""
113113

114-
try:
115-
cls_node = ast.parse(textwrap.dedent(inspect.getsource(cls))).body[0]
116-
except (OSError, KeyError, TypeError):
117-
# HACK: Python 3.13+ workaround - set missing __firstlineno__
118-
# Workaround can be removed after we upgrade to pydantic==2.12.0
119-
with open(inspect.getfile(cls)) as f:
120-
for i, line in enumerate(f):
121-
if f"class {cls.__name__}" in line and ":" in line:
122-
cls.__firstlineno__ = i + 1
123-
break
124-
cls_node = ast.parse(textwrap.dedent(inspect.getsource(cls))).body[0]
114+
cls_node = ast.parse(textwrap.dedent(inspect.getsource(cls))).body[0]
125115

126116
if not isinstance(cls_node, ast.ClassDef):
127117
raise TypeError("Given object was not a class.")

0 commit comments

Comments
 (0)