Skip to content

Commit

Permalink
Add support for Python 3.13 (#1845)
Browse files Browse the repository at this point in the history
* upgraded Python to 3.13

* tests: fix 3.13 tabulation problem

---------

Co-authored-by: Nikita Pastukhov <diementros@yandex.ru>
  • Loading branch information
davorrunje and Lancetnik authored Oct 12, 2024
1 parent 08b86ee commit c23106e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 25 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/pr_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
pydantic-version: ["pydantic-v1", "pydantic-v2"]
fail-fast: false

Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
Expand All @@ -124,7 +124,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
Expand All @@ -143,7 +143,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
Expand Down Expand Up @@ -182,7 +182,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
Expand Down Expand Up @@ -212,7 +212,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
Expand Down Expand Up @@ -251,7 +251,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
Expand Down Expand Up @@ -281,7 +281,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
Expand Down Expand Up @@ -309,7 +309,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
Expand Down Expand Up @@ -339,7 +339,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
Expand Down Expand Up @@ -367,7 +367,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
Expand Down Expand Up @@ -397,7 +397,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
Expand Down Expand Up @@ -425,7 +425,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Topic :: Software Development :: Libraries :: Python Modules",
Expand Down Expand Up @@ -66,7 +67,10 @@ rabbit = ["aio-pika>=9,<10"]

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

confluent = ["confluent-kafka>=2,<3"]
confluent = [
"confluent-kafka>=2,<3; python_version < '3.13'",
"confluent-kafka>=2.6,<3; python_version >= '3.13'",
]

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from dirty_equals import IsPartialDict

from docs.docs_src.getting_started.asyncapi.asyncapi_customization.custom_handler import (
app,
)
Expand All @@ -7,21 +9,33 @@
def test_handler_customization():
schema = get_app_schema(app).to_jsonable()

assert schema["channels"] == {
"input_data:Consume": {
"description": "Consumer function\n\n Args:\n msg: input msg\n ",
(subscriber_key, subscriber_value), (publisher_key, publisher_value) = schema[
"channels"
].items()

assert subscriber_key == "input_data:Consume", subscriber_key
assert subscriber_value == IsPartialDict(
{
"servers": ["development"],
"bindings": {"kafka": {"topic": "input_data", "bindingVersion": "0.4.0"}},
"subscribe": {
"message": {"$ref": "#/components/messages/input_data:Consume:Message"}
},
},
"output_data:Produce": {
"description": "My publisher description",
"servers": ["development"],
"bindings": {"kafka": {"topic": "output_data", "bindingVersion": "0.4.0"}},
"publish": {
"message": {"$ref": "#/components/messages/output_data:Produce:Message"}
},
}
), subscriber_value
desc = subscriber_value["description"]
assert ( # noqa: PT018
"Consumer function\n\n" in desc
and "Args:\n" in desc
and " msg: input msg" in desc
), desc

assert publisher_key == "output_data:Produce", publisher_key
assert publisher_value == {
"description": "My publisher description",
"servers": ["development"],
"bindings": {"kafka": {"topic": "output_data", "bindingVersion": "0.4.0"}},
"publish": {
"message": {"$ref": "#/components/messages/output_data:Produce:Message"}
},
}

0 comments on commit c23106e

Please sign in to comment.