Skip to content

Commit 025a3af

Browse files
committed
Support both versions of Starlette
Don't lock starlette version
1 parent cc094a5 commit 025a3af

3 files changed

Lines changed: 19 additions & 5 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ classifiers = [
2929
]
3030

3131
[project.optional-dependencies]
32-
http-server = ["fastapi>=0.115.2", "sse-starlette", "starlette>=0.48.0"]
32+
http-server = ["fastapi>=0.115.2", "sse-starlette", "starlette"]
3333
encryption = ["cryptography>=43.0.0"]
3434
grpc = ["grpcio>=1.60", "grpcio-tools>=1.60", "grpcio_reflection>=1.7.0"]
3535
telemetry = ["opentelemetry-api>=1.33.0", "opentelemetry-sdk>=1.33.0"]

src/a2a/server/apps/jsonrpc/jsonrpc_app.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,14 @@
6464
from starlette.exceptions import HTTPException
6565
from starlette.requests import Request
6666
from starlette.responses import JSONResponse, Response
67-
from starlette.status import HTTP_413_CONTENT_TOO_LARGE
67+
68+
try:
69+
# Starlette v0.48.0
70+
from starlette.status import HTTP_413_CONTENT_TOO_LARGE
71+
except ImportError:
72+
from starlette.status import (
73+
HTTP_413_REQUEST_ENTITY_TOO_LARGE as HTTP_413_CONTENT_TOO_LARGE,
74+
)
6875

6976
_package_starlette_installed = True
7077
else:
@@ -76,7 +83,14 @@
7683
from starlette.exceptions import HTTPException
7784
from starlette.requests import Request
7885
from starlette.responses import JSONResponse, Response
79-
from starlette.status import HTTP_413_CONTENT_TOO_LARGE
86+
87+
try:
88+
# Starlette v0.48.0
89+
from starlette.status import HTTP_413_CONTENT_TOO_LARGE
90+
except ImportError:
91+
from starlette.status import (
92+
HTTP_413_REQUEST_ENTITY_TOO_LARGE as HTTP_413_CONTENT_TOO_LARGE,
93+
)
8094

8195
_package_starlette_installed = True
8296
except ImportError:

uv.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)