Skip to content

Commit 3aaac9d

Browse files
authored
Upgrade to Python 3.12 and update dependencies (#262)
* Upgrade to Python 3.12 and update dependencies * update dev requirements * upgrade azurite * new mypy errors * Fix tests
1 parent 3cfdf92 commit 3aaac9d

File tree

14 files changed

+260
-233
lines changed

14 files changed

+260
-233
lines changed

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ services:
104104

105105
azurite:
106106
container_name: pcapis-azurite
107-
image: mcr.microsoft.com/azure-storage/azurite:3.30.0
107+
image: mcr.microsoft.com/azure-storage/azurite:3.35.0
108108
hostname: azurite
109109
command: "azurite --silent --blobHost 0.0.0.0 --queueHost 0.0.0.0 --tableHost
110110
0.0.0.0 -l /workspace"

pccommon/pccommon/middleware.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from fastapi.dependencies.utils import (
1010
get_body_field,
1111
get_dependant,
12+
get_flat_dependant,
1213
get_parameterless_sub_dependant,
1314
)
1415
from fastapi.responses import PlainTextResponse
@@ -85,7 +86,9 @@ def add_timeout(app: FastAPI, timeout_seconds: float) -> None:
8586
),
8687
)
8788
route.body_field = get_body_field(
88-
dependant=route.dependant, name=route.unique_id
89+
flat_dependant=get_flat_dependant(route.dependant),
90+
name=route.unique_id,
91+
embed_body_fields=True,
8992
)
9093
route.app = request_response(route.get_route_handler())
9194

pccommon/pccommon/openapi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
def recursive_itemfix(schema: Any) -> None:
55
try:
6-
if type(schema["items"]) == list:
6+
if isinstance(schema["items"], list):
77
schema["items"] = schema["items"][0]
88
except KeyError:
99
pass
@@ -15,7 +15,7 @@ def recursive_itemfix(schema: Any) -> None:
1515
pass
1616

1717
for _, v in schema.items():
18-
if type(v) == dict:
18+
if isinstance(v, dict):
1919
recursive_itemfix(v)
2020

2121

pccommon/pccommon/redis.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def rate_limit(
234234
"""
235235

236236
def _decorator(
237-
fn: Callable[..., Coroutine[Any, Any, T]]
237+
fn: Callable[..., Coroutine[Any, Any, T]],
238238
) -> Callable[..., Coroutine[Any, Any, T]]:
239239
async def _wrapper(*args: Any, **kwargs: Any) -> T:
240240
request: Optional[Request] = kwargs.get("request")
@@ -320,7 +320,7 @@ def back_pressure(
320320
"""
321321

322322
def _decorator(
323-
fn: Callable[..., Coroutine[Any, Any, T]]
323+
fn: Callable[..., Coroutine[Any, Any, T]],
324324
) -> Callable[..., Coroutine[Any, Any, T]]:
325325
async def _wrapper(*args: Any, **kwargs: Any) -> T:
326326
request: Optional[Request] = kwargs.get("request")

pccommon/requirements.txt

Lines changed: 59 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,172 +1,174 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.9
2+
# This file is autogenerated by pip-compile with Python 3.12
33
# by the following command:
44
#
55
# pip-compile --extra=server --output-file=pccommon/requirements.txt ./pccommon/pyproject.toml
66
#
77
annotated-types==0.7.0
88
# via pydantic
9-
anyio==4.4.0
9+
anyio==4.10.0
1010
# via starlette
11-
async-timeout==4.0.3
12-
# via redis
13-
azure-core==1.30.2
11+
azure-core==1.35.0
1412
# via
1513
# azure-data-tables
1614
# azure-identity
1715
# azure-storage-blob
1816
# opencensus-ext-azure
19-
azure-data-tables==12.5.0
17+
azure-data-tables==12.7.0
2018
# via pccommon (pccommon/pyproject.toml)
21-
azure-identity==1.16.1
19+
azure-identity==1.24.0
2220
# via
2321
# opencensus-ext-azure
2422
# pccommon (pccommon/pyproject.toml)
25-
azure-storage-blob==12.20.0
23+
azure-storage-blob==12.26.0
2624
# via pccommon (pccommon/pyproject.toml)
27-
beautifulsoup4==4.12.3
25+
beautifulsoup4==4.13.4
2826
# via html-sanitizer
29-
cachetools==5.3.3
27+
cachetools==5.5.2
3028
# via
3129
# google-auth
3230
# pccommon (pccommon/pyproject.toml)
33-
certifi==2024.7.4
31+
certifi==2025.8.3
3432
# via requests
35-
cffi==1.16.0
33+
cffi==1.17.1
3634
# via cryptography
37-
charset-normalizer==3.3.2
35+
charset-normalizer==3.4.3
3836
# via requests
39-
cryptography==42.0.8
37+
cryptography==45.0.6
4038
# via
4139
# azure-identity
4240
# azure-storage-blob
4341
# msal
4442
# pyjwt
45-
exceptiongroup==1.2.1
46-
# via anyio
47-
fastapi-slim==0.111.0
43+
fastapi-slim==0.116.1
4844
# via pccommon (pccommon/pyproject.toml)
49-
google-api-core==2.19.0
45+
google-api-core==2.25.1
5046
# via opencensus
51-
google-auth==2.30.0
47+
google-auth==2.40.3
5248
# via google-api-core
53-
googleapis-common-protos==1.63.1
49+
googleapis-common-protos==1.70.0
5450
# via google-api-core
55-
html-sanitizer==2.4.4
51+
html-sanitizer==2.6.0
5652
# via pccommon (pccommon/pyproject.toml)
57-
idna==3.7
53+
idna==3.10
5854
# via
5955
# anyio
6056
# pccommon (pccommon/pyproject.toml)
6157
# requests
6258
# yarl
63-
isodate==0.6.1
59+
isodate==0.7.2
6460
# via
6561
# azure-data-tables
6662
# azure-storage-blob
67-
lxml==5.2.2
63+
lxml==6.0.0
6864
# via
6965
# html-sanitizer
7066
# lxml-html-clean
71-
lxml-html-clean==0.1.0
67+
lxml-html-clean==0.4.2
7268
# via
7369
# html-sanitizer
7470
# pccommon (pccommon/pyproject.toml)
75-
msal==1.28.1
71+
msal==1.33.0
7672
# via
7773
# azure-identity
7874
# msal-extensions
79-
msal-extensions==1.1.0
75+
msal-extensions==1.3.1
8076
# via azure-identity
81-
multidict==6.0.5
77+
multidict==6.6.4
8278
# via yarl
8379
opencensus==0.11.4
8480
# via
8581
# opencensus-ext-azure
8682
# opencensus-ext-logging
8783
opencensus-context==0.1.3
8884
# via opencensus
89-
opencensus-ext-azure==1.1.13
85+
opencensus-ext-azure==1.1.15
9086
# via pccommon (pccommon/pyproject.toml)
9187
opencensus-ext-logging==0.1.1
9288
# via pccommon (pccommon/pyproject.toml)
93-
orjson==3.10.5
89+
orjson==3.11.2
9490
# via pccommon (pccommon/pyproject.toml)
95-
packaging==24.1
96-
# via msal-extensions
97-
portalocker==2.8.2
98-
# via msal-extensions
99-
proto-plus==1.23.0
91+
propcache==0.3.2
92+
# via yarl
93+
proto-plus==1.26.1
10094
# via google-api-core
101-
protobuf==4.25.3
95+
protobuf==6.31.1
10296
# via
10397
# google-api-core
10498
# googleapis-common-protos
10599
# proto-plus
106-
psutil==5.9.8
100+
psutil==7.0.0
107101
# via opencensus-ext-azure
108-
pyasn1==0.6.0
102+
pyasn1==0.6.1
109103
# via
110104
# pyasn1-modules
111105
# rsa
112-
pyasn1-modules==0.4.0
106+
pyasn1-modules==0.4.2
113107
# via google-auth
114108
pycparser==2.22
115109
# via cffi
116-
pydantic==2.7.4
110+
pydantic==2.11.7
117111
# via
118112
# fastapi-slim
119113
# pccommon (pccommon/pyproject.toml)
120114
# pydantic-settings
121-
pydantic-core==2.18.4
115+
pydantic-core==2.33.2
122116
# via pydantic
123-
pydantic-settings==2.3.3
117+
pydantic-settings==2.10.1
124118
# via pccommon (pccommon/pyproject.toml)
125-
pyhumps==3.5.3
119+
pyhumps==3.8.0
126120
# via pccommon (pccommon/pyproject.toml)
127-
pyjwt[crypto]==2.8.0
128-
# via msal
129-
python-dotenv==1.0.1
121+
pyjwt[crypto]==2.10.1
122+
# via
123+
# msal
124+
# pyjwt
125+
python-dotenv==1.1.1
130126
# via pydantic-settings
131-
redis==4.6.0
127+
redis==6.4.0
132128
# via pccommon (pccommon/pyproject.toml)
133-
requests==2.32.3
129+
requests==2.32.4
134130
# via
135131
# azure-core
136132
# google-api-core
137133
# msal
138134
# opencensus-ext-azure
139135
# pccommon (pccommon/pyproject.toml)
140-
rsa==4.9
136+
rsa==4.9.1
141137
# via google-auth
142-
six==1.16.0
138+
six==1.17.0
143139
# via
144140
# azure-core
145-
# isodate
146141
# opencensus
147142
sniffio==1.3.1
148143
# via anyio
149-
soupsieve==2.5
144+
soupsieve==2.7
150145
# via beautifulsoup4
151-
starlette==0.37.2
146+
starlette==0.47.2
152147
# via
153148
# fastapi-slim
154149
# pccommon (pccommon/pyproject.toml)
155-
types-cachetools==4.2.9
150+
types-cachetools==6.1.0.20250717
156151
# via pccommon (pccommon/pyproject.toml)
157-
typing-extensions==4.12.2
152+
typing-extensions==4.14.1
158153
# via
159154
# anyio
160155
# azure-core
161156
# azure-data-tables
157+
# azure-identity
162158
# azure-storage-blob
159+
# beautifulsoup4
163160
# fastapi-slim
164161
# pydantic
165162
# pydantic-core
166163
# starlette
167-
urllib3==2.2.2
164+
# typing-inspection
165+
typing-inspection==0.4.1
166+
# via
167+
# pydantic
168+
# pydantic-settings
169+
urllib3==2.5.0
168170
# via
169171
# pccommon (pccommon/pyproject.toml)
170172
# requests
171-
yarl==1.9.4
173+
yarl==1.20.1
172174
# via azure-data-tables

pcfuncs/tests/ipban/test_ipban.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def integration_clients(
107107

108108
@pytest.mark.integration
109109
def test_update_banned_ip_integration(
110-
integration_clients: Tuple[LogsQueryClient, TableClient]
110+
integration_clients: Tuple[LogsQueryClient, TableClient],
111111
) -> None:
112112
logger.info(f"Test id: {TEST_ID} - integration test is running")
113113
logs_query_client, table_client = integration_clients

pcstac/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
FROM mcr.microsoft.com/cbl-mariner/base/python:3.9
1+
FROM mcr.microsoft.com/azurelinux/base/python:3.12
22

33
RUN tdnf install -y ca-certificates build-essential \
44
&& tdnf clean all
55

6-
ENV CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt
7-
86
WORKDIR /opt/src
97

108
COPY pcstac /opt/src/pcstac

0 commit comments

Comments
 (0)