From d031fb7b3d65a3aa95949f40a8943719e683264b Mon Sep 17 00:00:00 2001 From: Roman Inflianskas Date: Fri, 5 Jul 2024 21:44:58 +0300 Subject: [PATCH] Add support for Python 3.13 Fixes https://github.com/celery/kombu/issues/2051. --- .github/workflows/ci.yaml | 16 ++++++++++++++-- kombu/transport/redis.py | 2 +- requirements/extras/confluentkafka.txt | 2 +- requirements/extras/zstd.txt | 2 +- tox.ini | 18 ++++++++++-------- 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 985d6ddde..a183a1224 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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"] exclude: - python-version: "3.9" steps: @@ -19,6 +19,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 @@ -31,7 +35,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 @@ -46,6 +50,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". @@ -76,6 +84,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 diff --git a/kombu/transport/redis.py b/kombu/transport/redis.py index 515d6f7d7..29909dbe5 100644 --- a/kombu/transport/redis.py +++ b/kombu/transport/redis.py @@ -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 diff --git a/requirements/extras/confluentkafka.txt b/requirements/extras/confluentkafka.txt index 746267a87..d8f7d651a 100644 --- a/requirements/extras/confluentkafka.txt +++ b/requirements/extras/confluentkafka.txt @@ -1 +1 @@ -confluent-kafka>=2.2.0 +confluent-kafka>=2.2.0 ; python_version < "3.13" diff --git a/requirements/extras/zstd.txt b/requirements/extras/zstd.txt index 864700d2b..6b7101804 100644 --- a/requirements/extras/zstd.txt +++ b/requirements/extras/zstd.txt @@ -1 +1 @@ -zstandard +zstandard ; python_version < "3.13" diff --git a/tox.ini b/tox.ini index 3f48d5b6a..d52bc44a1 100644 --- a/tox.ini +++ b/tox.ini @@ -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 @@ -20,6 +20,7 @@ python = 3.10: py310, mypy 3.11: py311 3.12: py312 + 3.13: py313 [testenv] sitepackages = False @@ -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 @@ -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} @@ -135,4 +137,4 @@ commands = pydocstyle {toxinidir}/kombu [testenv:mypy] -commands = python -m mypy --config-file setup.cfg \ No newline at end of file +commands = python -m mypy --config-file setup.cfg