Skip to content

Commit 125e103

Browse files
authored
⬆️♻️Uniformize uvicorn/fastapi dependencies repository-wide (ITISFoundation#7765)
1 parent e53c704 commit 125e103

File tree

51 files changed

+669
-337
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+669
-337
lines changed

ci/helpers/requirements/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ charset-normalizer==3.4.1
2020
# via requests
2121
docker==7.1.0
2222
# via -r requirements/requirements.in
23-
fastapi==0.115.0
23+
fastapi==0.115.12
2424
# via -r requirements/requirements.in
2525
frozenlist==1.4.1
2626
# via
@@ -49,7 +49,7 @@ requests==2.32.3
4949
# via docker
5050
sniffio==1.3.1
5151
# via anyio
52-
starlette==0.38.6
52+
starlette==0.46.2
5353
# via
5454
# -c requirements/../../../requirements/constraints.txt
5555
# fastapi

packages/aws-library/requirements/_test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ docker==7.1.0
7070
# via moto
7171
faker==36.1.1
7272
# via -r requirements/_test.in
73-
fastapi==0.115.11
73+
fastapi==0.115.12
7474
# via -r requirements/_test.in
7575
flask==3.1.0
7676
# via

packages/service-library/requirements/_base.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ pyinstrument==5.0.1
220220
# via -r requirements/_base.in
221221
python-dateutil==2.9.0.post0
222222
# via arrow
223-
python-dotenv==1.0.1
223+
python-dotenv==1.1.0
224224
# via pydantic-settings
225225
pyyaml==6.0.2
226226
# via
@@ -252,7 +252,7 @@ referencing==0.35.1
252252
# jsonschema-specifications
253253
requests==2.32.3
254254
# via opentelemetry-exporter-otlp-proto-http
255-
rich==13.9.4
255+
rich==14.0.0
256256
# via
257257
# -r requirements/../../../packages/settings-library/requirements/_base.in
258258
# typer
@@ -274,7 +274,7 @@ toolz==1.0.0
274274
# via -r requirements/_base.in
275275
tqdm==4.67.1
276276
# via -r requirements/_base.in
277-
typer==0.15.2
277+
typer==0.16.0
278278
# via -r requirements/../../../packages/settings-library/requirements/_base.in
279279
types-python-dateutil==2.9.0.20241206
280280
# via arrow

packages/service-library/requirements/_fastapi.in

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
#
55

66

7-
fastapi
7+
fastapi[standard]
88
fastapi-lifespan-manager
9-
httpx
9+
httpx[http2]
1010
opentelemetry-instrumentation-fastapi
1111
opentelemetry-instrumentation-httpx
1212
prometheus-client
13-
uvicorn

packages/service-library/requirements/_fastapi.txt

Lines changed: 62 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,67 @@ anyio==4.8.0
44
# via
55
# httpx
66
# starlette
7+
# watchfiles
78
asgiref==3.8.1
89
# via opentelemetry-instrumentation-asgi
910
certifi==2025.1.31
1011
# via
1112
# httpcore
1213
# httpx
1314
click==8.1.8
14-
# via uvicorn
15+
# via
16+
# rich-toolkit
17+
# typer
18+
# uvicorn
1519
deprecated==1.2.18
1620
# via
1721
# opentelemetry-api
1822
# opentelemetry-semantic-conventions
19-
fastapi==0.115.11
23+
dnspython==2.7.0
24+
# via email-validator
25+
email-validator==2.2.0
26+
# via fastapi
27+
fastapi==0.115.12
2028
# via
2129
# -r requirements/_fastapi.in
2230
# fastapi-lifespan-manager
31+
fastapi-cli==0.0.7
32+
# via fastapi
2333
fastapi-lifespan-manager==0.1.4
2434
# via -r requirements/_fastapi.in
2535
h11==0.14.0
2636
# via
2737
# httpcore
2838
# uvicorn
39+
h2==4.2.0
40+
# via httpx
41+
hpack==4.1.0
42+
# via h2
2943
httpcore==1.0.7
3044
# via httpx
45+
httptools==0.6.4
46+
# via uvicorn
3147
httpx==0.28.1
32-
# via -r requirements/_fastapi.in
48+
# via
49+
# -r requirements/_fastapi.in
50+
# fastapi
51+
hyperframe==6.1.0
52+
# via h2
3353
idna==3.10
3454
# via
3555
# anyio
56+
# email-validator
3657
# httpx
3758
importlib-metadata==8.5.0
3859
# via opentelemetry-api
60+
jinja2==3.1.6
61+
# via fastapi
62+
markdown-it-py==3.0.0
63+
# via rich
64+
markupsafe==3.0.2
65+
# via jinja2
66+
mdurl==0.1.2
67+
# via markdown-it-py
3968
opentelemetry-api==1.30.0
4069
# via
4170
# opentelemetry-instrumentation
@@ -73,18 +102,46 @@ pydantic==2.10.6
73102
# via fastapi
74103
pydantic-core==2.27.2
75104
# via pydantic
105+
pygments==2.19.1
106+
# via rich
107+
python-dotenv==1.1.0
108+
# via uvicorn
109+
python-multipart==0.0.20
110+
# via fastapi
111+
pyyaml==6.0.2
112+
# via uvicorn
113+
rich==14.0.0
114+
# via
115+
# rich-toolkit
116+
# typer
117+
rich-toolkit==0.14.7
118+
# via fastapi-cli
119+
shellingham==1.5.4
120+
# via typer
76121
sniffio==1.3.1
77122
# via anyio
78123
starlette==0.46.0
79124
# via fastapi
125+
typer==0.16.0
126+
# via fastapi-cli
80127
typing-extensions==4.12.2
81128
# via
82129
# anyio
83130
# fastapi
84131
# pydantic
85132
# pydantic-core
86-
uvicorn==0.34.0
87-
# via -r requirements/_fastapi.in
133+
# rich-toolkit
134+
# typer
135+
uvicorn==0.34.2
136+
# via
137+
# fastapi
138+
# fastapi-cli
139+
uvloop==0.21.0
140+
# via uvicorn
141+
watchfiles==1.0.5
142+
# via uvicorn
143+
websockets==15.0.1
144+
# via uvicorn
88145
wrapt==1.17.2
89146
# via
90147
# deprecated

packages/service-library/requirements/_test.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,16 @@ python-dateutil==2.9.0.post0
191191
# via
192192
# -c requirements/_base.txt
193193
# botocore
194-
python-dotenv==1.0.1
194+
python-dotenv==1.1.0
195195
# via
196196
# -c requirements/_base.txt
197+
# -c requirements/_fastapi.txt
197198
# -r requirements/_test.in
198199
pyyaml==6.0.2
199200
# via
200201
# -c requirements/../../../requirements/constraints.txt
201202
# -c requirements/_base.txt
203+
# -c requirements/_fastapi.txt
202204
# jsonschema-path
203205
referencing==0.35.1
204206
# via

packages/service-library/tests/fastapi/test_cancellation_middleware.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from pytest_simcore.helpers.logging_tools import log_context
1414
from servicelib.fastapi.cancellation_middleware import RequestCancellationMiddleware
1515
from servicelib.utils import unused_port
16+
from tenacity import retry, stop_after_delay, wait_fixed
1617
from yarl import URL
1718

1819

@@ -32,6 +33,12 @@ def fastapi_router(
3233
) -> APIRouter:
3334
router = APIRouter()
3435

36+
@router.get("/")
37+
async def root() -> dict[str, str]:
38+
with log_context(logging.INFO, msg="root endpoint") as ctx:
39+
ctx.logger.info("root endpoint called")
40+
return {"message": "Hello, World!"}
41+
3542
@router.get("/sleep")
3643
async def sleep(sleep_time: float) -> dict[str, str]:
3744
with log_context(logging.INFO, msg="sleeper") as ctx:
@@ -93,6 +100,16 @@ def uvicorn_server(fastapi_app: FastAPI) -> Iterator[URL]:
93100
thread.daemon = True
94101
thread.start()
95102

103+
@retry(wait=wait_fixed(0.1), stop=stop_after_delay(10), reraise=True)
104+
def wait_for_server_ready() -> None:
105+
with httpx.Client() as client:
106+
response = client.get(f"http://127.0.1:{random_port}/")
107+
assert (
108+
response.is_success
109+
), f"Server did not start successfully: {response.status_code} {response.text}"
110+
111+
wait_for_server_ready()
112+
96113
ctx.logger.info(
97114
"server ready at: %s",
98115
f"http://127.0.0.1:{random_port}",

services/agent/requirements/_base.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,5 @@
1414
--requirement ../../../packages/service-library/requirements/_fastapi.in
1515

1616
aiodocker
17-
fastapi
1817
packaging
1918
pydantic
20-
uvicorn

0 commit comments

Comments
 (0)