Skip to content

Commit

Permalink
Add support for Python 3.13
Browse files Browse the repository at this point in the history
Fixes #2051.
  • Loading branch information
rominf committed Jul 12, 2024
1 parent f61c6d1 commit d14fa66
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 18 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,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"]
steps:
- name: Install system packages
run: sudo apt-get update && sudo apt-get install libcurl4-openssl-dev libssl-dev
Expand All @@ -17,6 +17,10 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Allow pre-releases in tox on Python 3.13
run: echo "PIP_PRE=1" >> $GITHUB_ENV
if: ${{ matrix.python-version == '3.13' }}
- name: Install dependencies
run: pip install --upgrade pip wheel tox tox-docker
- name: Run unittest
Expand All @@ -29,7 +33,7 @@ jobs:
strategy:
fail-fast: false
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"]
experimental: [false]
include:
- python-version: pypy3.9
Expand All @@ -44,6 +48,10 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Allow pre-releases in tox on Python 3.13
run: echo "PIP_PRE=1" >> $GITHUB_ENV
if: ${{ matrix.python-version == '3.13' }}
- name: Install dependencies
run: pip install --upgrade pip wheel tox tox-docker
# Tox fails if a Python versions contains a hyphen, this changes "pypy-3.9" to "pypy3.9".
Expand Down Expand Up @@ -74,6 +82,10 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Allow pre-releases in tox on Python 3.13
run: echo "PIP_PRE=1" >> $GITHUB_ENV
if: ${{ matrix.python-version == '3.13' }}
- name: Install dependencies
run: pip install --upgrade pip wheel tox tox-docker
- name: Run flake8
Expand Down
2 changes: 1 addition & 1 deletion kombu/transport/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@


logger = get_logger('kombu.transport.redis')
crit, warn = logger.critical, logger.warn
crit, warn = logger.critical, logger.warning

DEFAULT_PORT = 6379
DEFAULT_DB = 0
Expand Down
2 changes: 1 addition & 1 deletion requirements/extras/confluentkafka.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
confluent-kafka>=2.2.0
confluent-kafka>=2.2.0 ; python_version < "3.13"
2 changes: 1 addition & 1 deletion requirements/extras/zstd.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
zstandard
zstandard ; python_version < "3.13"
15 changes: 10 additions & 5 deletions t/unit/transport/test_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1326,11 +1326,16 @@ def pipeline(transaction=True, shard_hint=None):

channel.qos.restore_by_tag('test-tag')
assert mock_execute_command is not None
assert mock_execute_command.mock_calls == [
call('WATCH', 'foo_unacked'),
call('HGET', 'foo_unacked', 'test-tag'),
call('ZREM', 'foo_unacked_index', 'test-tag'),
call('HDEL', 'foo_unacked', 'test-tag')
# https://github.com/redis/redis-py/pull/3038 (redis>=5.1.0a1)
# adds keyword argument `keys` to redis client.
# To be compatible with all supported redis versions,
# take into account only `call.args`.
call_args = [call.args for call in mock_execute_command.mock_calls]
assert call_args == [
('WATCH', 'foo_unacked'),
('HGET', 'foo_unacked', 'test-tag'),
('ZREM', 'foo_unacked_index', 'test-tag'),
('HDEL', 'foo_unacked', 'test-tag')
]


Expand Down
18 changes: 10 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[tox]
envlist =
{pypy3.9,3.8,3.9,3.10,3.11,3.12}-unit
{pypy3.9,3.8,3.9,3.10,3.11,3.12}-linux-integration-py-amqp
{pypy3.9,3.8,3.9,3.10,3.11,3.12,3.13}-unit
{pypy3.9,3.8,3.9,3.10,3.11,3.12,3.13}-linux-integration-py-amqp
{pypy3.9,3.8,3.9,3.10,3.11}-linux-integration-redis
{pypy3.9,3.8,3.9,3.10,3.11}-linux-integration-mongodb
{3.8,3.9,3.10,3.11,3.12}-linux-integration-kafka
{3.8,3.9,3.10,3.11,3.12,3.13}-linux-integration-kafka
flake8
apicheck
pydocstyle
Expand All @@ -20,6 +20,7 @@ python =
3.10: py310, mypy
3.11: py311
3.12: py312
3.13: py313

[testenv]
sitepackages = False
Expand All @@ -28,10 +29,10 @@ passenv =
DISTUTILS_USE_SDK
deps=
-r{toxinidir}/requirements/dev.txt
apicheck,pypy3.9,3.8,3.9,3.10,3.11,3.12: -r{toxinidir}/requirements/default.txt
apicheck,pypy3.9,3.8,3.9,3.10,3.11,3.12: -r{toxinidir}/requirements/test.txt
apicheck,pypy3.9,3.8,3.9,3.10,3.11,3.12: -r{toxinidir}/requirements/test-ci.txt
apicheck,3.8-linux,3.9-linux,3.10-linux,3.11-linux,3.12-linux: -r{toxinidir}/requirements/extras/confluentkafka.txt
apicheck,pypy3.9,3.8,3.9,3.10,3.11,3.12,3.13: -r{toxinidir}/requirements/default.txt
apicheck,pypy3.9,3.8,3.9,3.10,3.11,3.12,3.13: -r{toxinidir}/requirements/test.txt
apicheck,pypy3.9,3.8,3.9,3.10,3.11,3.12,3.13: -r{toxinidir}/requirements/test-ci.txt
apicheck,3.8-linux,3.9-linux,3.10-linux,3.11-linux,3.12-linux,3.13-linux: -r{toxinidir}/requirements/extras/confluentkafka.txt
apicheck,linkcheck: -r{toxinidir}/requirements/docs.txt
flake8,pydocstyle,mypy: -r{toxinidir}/requirements/pkgutils.txt

Expand All @@ -50,6 +51,7 @@ basepython =
3.10,apicheck,pydocstyle,flake8,linkcheck,cov,mypy: python3.10
3.11: python3.11
3.12: python3.12
3.13: python3.13

install_command = python -m pip --disable-pip-version-check install {opts} {packages}

Expand Down Expand Up @@ -135,4 +137,4 @@ commands =
pydocstyle {toxinidir}/kombu

[testenv:mypy]
commands = python -m mypy --config-file setup.cfg
commands = python -m mypy --config-file setup.cfg

0 comments on commit d14fa66

Please sign in to comment.