Skip to content

Commit c23106e

Browse files
Add support for Python 3.13 (#1845)
* upgraded Python to 3.13 * tests: fix 3.13 tabulation problem --------- Co-authored-by: Nikita Pastukhov <[email protected]>
1 parent 08b86ee commit c23106e

File tree

3 files changed

+43
-25
lines changed

3 files changed

+43
-25
lines changed

.github/workflows/pr_tests.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
runs-on: ubuntu-latest
5656
strategy:
5757
matrix:
58-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
58+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
5959
pydantic-version: ["pydantic-v1", "pydantic-v2"]
6060
fail-fast: false
6161

@@ -105,7 +105,7 @@ jobs:
105105
- name: Set up Python
106106
uses: actions/setup-python@v5
107107
with:
108-
python-version: "3.12"
108+
python-version: "3.13"
109109
- name: Install Dependencies
110110
if: steps.cache.outputs.cache-hit != 'true'
111111
run: |
@@ -124,7 +124,7 @@ jobs:
124124
- name: Set up Python
125125
uses: actions/setup-python@v5
126126
with:
127-
python-version: "3.12"
127+
python-version: "3.13"
128128
- name: Install Dependencies
129129
if: steps.cache.outputs.cache-hit != 'true'
130130
run: |
@@ -143,7 +143,7 @@ jobs:
143143
- name: Set up Python
144144
uses: actions/setup-python@v5
145145
with:
146-
python-version: "3.12"
146+
python-version: "3.13"
147147
- name: Install Dependencies
148148
if: steps.cache.outputs.cache-hit != 'true'
149149
run: |
@@ -182,7 +182,7 @@ jobs:
182182
- name: Set up Python
183183
uses: actions/setup-python@v5
184184
with:
185-
python-version: "3.12"
185+
python-version: "3.13"
186186
- name: Install Dependencies
187187
if: steps.cache.outputs.cache-hit != 'true'
188188
run: |
@@ -212,7 +212,7 @@ jobs:
212212
- name: Set up Python
213213
uses: actions/setup-python@v5
214214
with:
215-
python-version: "3.12"
215+
python-version: "3.13"
216216
- name: Install Dependencies
217217
if: steps.cache.outputs.cache-hit != 'true'
218218
run: |
@@ -251,7 +251,7 @@ jobs:
251251
- name: Set up Python
252252
uses: actions/setup-python@v5
253253
with:
254-
python-version: "3.12"
254+
python-version: "3.13"
255255
- name: Install Dependencies
256256
if: steps.cache.outputs.cache-hit != 'true'
257257
run: |
@@ -281,7 +281,7 @@ jobs:
281281
- name: Set up Python
282282
uses: actions/setup-python@v5
283283
with:
284-
python-version: "3.12"
284+
python-version: "3.13"
285285
- name: Install Dependencies
286286
if: steps.cache.outputs.cache-hit != 'true'
287287
run: |
@@ -309,7 +309,7 @@ jobs:
309309
- name: Set up Python
310310
uses: actions/setup-python@v5
311311
with:
312-
python-version: "3.12"
312+
python-version: "3.13"
313313
- name: Install Dependencies
314314
if: steps.cache.outputs.cache-hit != 'true'
315315
run: |
@@ -339,7 +339,7 @@ jobs:
339339
- name: Set up Python
340340
uses: actions/setup-python@v5
341341
with:
342-
python-version: "3.12"
342+
python-version: "3.13"
343343
- name: Install Dependencies
344344
if: steps.cache.outputs.cache-hit != 'true'
345345
run: |
@@ -367,7 +367,7 @@ jobs:
367367
- name: Set up Python
368368
uses: actions/setup-python@v5
369369
with:
370-
python-version: "3.12"
370+
python-version: "3.13"
371371
- name: Install Dependencies
372372
if: steps.cache.outputs.cache-hit != 'true'
373373
run: |
@@ -397,7 +397,7 @@ jobs:
397397
- name: Set up Python
398398
uses: actions/setup-python@v5
399399
with:
400-
python-version: "3.12"
400+
python-version: "3.13"
401401
- name: Install Dependencies
402402
if: steps.cache.outputs.cache-hit != 'true'
403403
run: |
@@ -425,7 +425,7 @@ jobs:
425425
- name: Set up Python
426426
uses: actions/setup-python@v5
427427
with:
428-
python-version: "3.12"
428+
python-version: "3.13"
429429
- name: Install Dependencies
430430
if: steps.cache.outputs.cache-hit != 'true'
431431
run: |

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ classifiers = [
3434
"Programming Language :: Python :: 3.10",
3535
"Programming Language :: Python :: 3.11",
3636
"Programming Language :: Python :: 3.12",
37+
"Programming Language :: Python :: 3.13",
3738
"Operating System :: OS Independent",
3839
"Topic :: Software Development :: Libraries :: Application Frameworks",
3940
"Topic :: Software Development :: Libraries :: Python Modules",
@@ -66,7 +67,10 @@ rabbit = ["aio-pika>=9,<10"]
6667

6768
kafka = ["aiokafka>=0.9,<0.12"]
6869

69-
confluent = ["confluent-kafka>=2,<3"]
70+
confluent = [
71+
"confluent-kafka>=2,<3; python_version < '3.13'",
72+
"confluent-kafka>=2.6,<3; python_version >= '3.13'",
73+
]
7074

7175
nats = ["nats-py>=2.7.0,<=3.0.0"]
7276

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from dirty_equals import IsPartialDict
2+
13
from docs.docs_src.getting_started.asyncapi.asyncapi_customization.custom_handler import (
24
app,
35
)
@@ -7,21 +9,33 @@
79
def test_handler_customization():
810
schema = get_app_schema(app).to_jsonable()
911

10-
assert schema["channels"] == {
11-
"input_data:Consume": {
12-
"description": "Consumer function\n\n Args:\n msg: input msg\n ",
12+
(subscriber_key, subscriber_value), (publisher_key, publisher_value) = schema[
13+
"channels"
14+
].items()
15+
16+
assert subscriber_key == "input_data:Consume", subscriber_key
17+
assert subscriber_value == IsPartialDict(
18+
{
1319
"servers": ["development"],
1420
"bindings": {"kafka": {"topic": "input_data", "bindingVersion": "0.4.0"}},
1521
"subscribe": {
1622
"message": {"$ref": "#/components/messages/input_data:Consume:Message"}
1723
},
18-
},
19-
"output_data:Produce": {
20-
"description": "My publisher description",
21-
"servers": ["development"],
22-
"bindings": {"kafka": {"topic": "output_data", "bindingVersion": "0.4.0"}},
23-
"publish": {
24-
"message": {"$ref": "#/components/messages/output_data:Produce:Message"}
25-
},
24+
}
25+
), subscriber_value
26+
desc = subscriber_value["description"]
27+
assert ( # noqa: PT018
28+
"Consumer function\n\n" in desc
29+
and "Args:\n" in desc
30+
and " msg: input msg" in desc
31+
), desc
32+
33+
assert publisher_key == "output_data:Produce", publisher_key
34+
assert publisher_value == {
35+
"description": "My publisher description",
36+
"servers": ["development"],
37+
"bindings": {"kafka": {"topic": "output_data", "bindingVersion": "0.4.0"}},
38+
"publish": {
39+
"message": {"$ref": "#/components/messages/output_data:Produce:Message"}
2640
},
2741
}

0 commit comments

Comments
 (0)