Skip to content

Commit

Permalink
Drop Python 3.6, add 3.10 (#841)
Browse files Browse the repository at this point in the history
* Drop Python 3.6, add 3.10

* Add line on 3.10 support to changelog
  • Loading branch information
ods committed Jul 1, 2022
1 parent 5553d8f commit 6360747
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 88 deletions.
48 changes: 20 additions & 28 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Build wheels
env:
CIBW_ARCHS_LINUX: ${{matrix.arch}}
CIBW_BUILD: cp36-* cp37-* cp38-* cp39-*
CIBW_BUILD: cp37-* cp38-* cp39-* cp310-*
CIBW_SKIP: '*-musllinux*'
CIBW_BEFORE_BUILD_LINUX: pip install -r requirements-cython.txt && yum install -y zlib-devel
# On windows and mac we should have z library preinstalled
Expand All @@ -74,19 +74,14 @@ jobs:

strategy:
matrix:
python: [3.6, 3.7, 3.8, 3.9]
# 3.10 is excluded because docker's dependency on pywin32==227
python: ["3.7", "3.8", "3.9"]
include:
- python: 3.6
snappy_whl: tools/python_snappy-0.5.4-cp36-cp36m-win_amd64.whl
aiokafka_whl: dist/aiokafka-*-cp36-cp36m-win_amd64.whl
- python: 3.7
snappy_whl: tools/python_snappy-0.5.4-cp37-cp37m-win_amd64.whl
- python: "3.7"
aiokafka_whl: dist/aiokafka-*-cp37-cp37m-win_amd64.whl
- python: 3.8
snappy_whl: tools/python_snappy-0.5.4-cp38-cp38-win_amd64.whl
- python: "3.8"
aiokafka_whl: dist/aiokafka-*-cp38-cp38-win_amd64.whl
- python: 3.9
snappy_whl: tools/python_snappy-0.5.4-cp39-cp39-win_amd64.whl
- python: "3.9"
aiokafka_whl: dist/aiokafka-*-cp39-cp39-win_amd64.whl

steps:
Expand All @@ -104,7 +99,6 @@ jobs:
- name: Install python dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install ${{ matrix.snappy_whl }}
pip install -r requirements-win-test.txt
pip install ${{ matrix.aiokafka_whl }}
shell: bash
Expand All @@ -122,16 +116,16 @@ jobs:

strategy:
matrix:
python: [3.6, 3.7, 3.8, 3.9]
python: ["3.7", "3.8", "3.9", "3.10"]
include:
- python: 3.6
aiokafka_whl: dist/aiokafka-*-cp36-cp36m-macosx_10_9_x86_64.whl
- python: 3.7
- python: "3.7"
aiokafka_whl: dist/aiokafka-*-cp37-cp37m-macosx_10_9_x86_64.whl
- python: 3.8
- python: "3.8"
aiokafka_whl: dist/aiokafka-*-cp38-cp38-macosx_10_9_x86_64.whl
- python: 3.9
- python: "3.9"
aiokafka_whl: dist/aiokafka-*-cp39-cp39-macosx_10_9_x86_64.whl
- python: "3.10"
aiokafka_whl: dist/aiokafka-*-cp310-cp310-macosx_10_9_x86_64.whl

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -166,16 +160,16 @@ jobs:

strategy:
matrix:
python: [3.6, 3.7, 3.8.5, 3.9]
python: ["3.7", "3.8", "3.9", "3.10"]
include:
- python: 3.6
aiokafka_whl: dist/aiokafka-*-cp36-cp36m-manylinux*_x86_64.whl
- python: 3.7
- python: "3.7"
aiokafka_whl: dist/aiokafka-*-cp37-cp37m-manylinux*_x86_64.whl
- python: 3.8.5
- python: "3.8"
aiokafka_whl: dist/aiokafka-*-cp38-cp38-manylinux*_x86_64.whl
- python: 3.9
- python: "3.9"
aiokafka_whl: dist/aiokafka-*-cp39-cp39-manylinux*_x86_64.whl
- python: "3.10"
aiokafka_whl: dist/aiokafka-*-cp310-cp310-manylinux*_x86_64.whl

steps:
- uses: actions/checkout@v2
Expand All @@ -200,8 +194,6 @@ jobs:
pip install ${{ matrix.aiokafka_whl }}
- name: Run Unit Tests
# FIXME 3.8.6 and 3.9.0 have broken `wait_for`
if: ${{ matrix.python != '3.9' }}
run: |
# Remove source code to be sure we use wheel code
rm -rf aiokafka
Expand All @@ -217,14 +209,14 @@ jobs:
strategy:
matrix:
include:
- pyver: cp36-cp36m
aiokafka_whl: dist/aiokafka-*-cp36-cp36m-manylinux*_aarch64.whl
- pyver: cp37-cp37m
aiokafka_whl: dist/aiokafka-*-cp37-cp37m-manylinux*_aarch64.whl
- pyver: cp38-cp38
aiokafka_whl: dist/aiokafka-*-cp38-cp38-manylinux*_aarch64.whl
- pyver: cp39-cp39
aiokafka_whl: dist/aiokafka-*-cp39-cp39-manylinux*_aarch64.whl
- pyver: cp310-cp310
aiokafka_whl: dist/aiokafka-*-cp310-cp310-manylinux*_aarch64.whl

steps:
- uses: actions/checkout@v2
Expand Down
37 changes: 19 additions & 18 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ jobs:

strategy:
matrix:
python: [3.6, 3.7, 3.8, 3.9]
# 3.10 is excluded because docker's dependency on pywin32==227
python: ["3.7", "3.8", "3.9"]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -141,7 +142,7 @@ jobs:

strategy:
matrix:
python: [3.6, 3.7, 3.8, 3.9]
python: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -214,53 +215,53 @@ jobs:
strategy:
matrix:
include:
- python: 3.9
- python: "3.10"
kafka: "2.8.1"
scala: "2.13"

# Older python versions against latest broker
- python: 3.6
- python: "3.7"
kafka: "2.8.1"
scala: "2.13"
- python: 3.7
- python: "3.8"
kafka: "2.8.1"
scala: "2.13"
- python: 3.8
- python: "3.9"
kafka: "2.8.1"
scala: "2.13"

# Older/newer brokers against latest python version
- python: 3.9
# Older brokers against latest python version
- python: "3.10"
kafka: "0.9.0.1"
scala: "2.11"
- python: 3.9
- python: "3.10"
kafka: "0.10.2.1"
scala: "2.11"
- python: 3.9
- python: "3.10"
kafka: "0.11.0.3"
scala: "2.12"
- python: 3.9
- python: "3.10"
kafka: "1.1.1"
scala: "2.12"
- python: 3.9
- python: "3.10"
kafka: "2.1.1"
scala: "2.12"
- python: 3.9
- python: "3.10"
kafka: "2.2.2"
scala: "2.12"
- python: 3.9
- python: "3.10"
kafka: "2.3.1"
scala: "2.12"
- python: 3.9
- python: "3.10"
kafka: "2.4.1"
scala: "2.12"
- python: 3.9
- python: "3.10"
kafka: "2.5.1"
scala: "2.12"
- python: 3.9
- python: "3.10"
kafka: "2.6.3"
scala: "2.12"
- python: 3.9
- python: "3.10"
kafka: "2.7.2"
scala: "2.13"
fail-fast: false
Expand Down
2 changes: 2 additions & 0 deletions CHANGES/841.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Drop support for Python 3.6, add support and pre-built packages for Python 3.10
(pr #841)
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ lint:
mypy --install-types --non-interactive $(FORMATTED_AREAS)

test: flake
py.test -s --show-capture=no --docker-image $(DOCKER_IMAGE) $(FLAGS) tests
pytest -s --show-capture=no --docker-image $(DOCKER_IMAGE) $(FLAGS) tests

vtest: flake
py.test -s -v --log-level INFO --docker-image $(DOCKER_IMAGE) $(FLAGS) tests
pytest -s -v --log-level INFO --docker-image $(DOCKER_IMAGE) $(FLAGS) tests

cov cover coverage: flake
py.test -s --cov aiokafka --cov-report html --docker-image $(DOCKER_IMAGE) $(FLAGS) tests
pytest -s --cov aiokafka --cov-report html --docker-image $(DOCKER_IMAGE) $(FLAGS) tests
@echo "open file://`pwd`/htmlcov/index.html"

ci-test-unit:
py.test -s --log-format="%(asctime)s %(levelname)s %(message)s" --log-level DEBUG --cov aiokafka --cov-report xml --color=yes $(FLAGS) tests
pytest -s --log-format="%(asctime)s %(levelname)s %(message)s" --log-level DEBUG --cov aiokafka --cov-report xml --color=yes $(FLAGS) tests

ci-test-all:
py.test -s -v --log-format="%(asctime)s %(levelname)s %(message)s" --log-level DEBUG --cov aiokafka --cov-report xml --color=yes --docker-image $(DOCKER_IMAGE) $(FLAGS) tests
pytest -s -v --log-format="%(asctime)s %(levelname)s %(message)s" --log-level DEBUG --cov aiokafka --cov-report xml --color=yes --docker-image $(DOCKER_IMAGE) $(FLAGS) tests

coverage.xml: .coverage
coverage xml
Expand Down
4 changes: 2 additions & 2 deletions aiokafka/util.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio
import os
from asyncio import AbstractEventLoop
from typing import Awaitable, Dict, Tuple, TypeVar, Union, cast
from typing import Any, Awaitable, Coroutine, Dict, Tuple, TypeVar, Union, cast

import async_timeout
from packaging.version import Version
Expand All @@ -21,7 +21,7 @@
T = TypeVar("T")


def create_task(coro: Awaitable[T]) -> "asyncio.Task[T]":
def create_task(coro: Coroutine[Any, Any, T]) -> "asyncio.Task[T]":
loop = get_running_loop()
return loop.create_task(coro)

Expand Down
7 changes: 6 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
[pytest]
filterwarnings =
error
# FIXME Until we fix socket leaks in tests
default:unclosed event loop:ResourceWarning
# https://github.com/docker/docker-py/issues/1293
ignore:.*docker.sock.*:ResourceWarning
ignore:distutils Version classes are deprecated:DeprecationWarning:docker
ignore:distutils .* deprecated:DeprecationWarning:docker
# From gssapi, but with improper stack
ignore:_SixMetaPathImporter.*not found:ImportWarning
# Actually comes from docker importing distutils on Windows
ignore:the imp module is deprecated in favour of importlib:DeprecationWarning:pywintypes
markers =
ssl: Tests that require SSL certificates to run
asyncio_mode = auto
13 changes: 6 additions & 7 deletions requirements-ci.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
-r requirements-cython.txt
flake8==4.0.1
black==22.3.0
mypy==0.910
mypy==0.961
isort[colors]==5.10.0
pytest==6.1.2
pytest==7.1.2
pytest-cov==3.0.0
pytest-asyncio==0.16.0
pytest-asyncio==0.18.3
docker==5.0.3
chardet==4.0.0 # Until fixed requests is released
lz4==3.1.3
xxhash==2.0.2
python-snappy==0.6.0
python-snappy==0.6.1
docutils==0.17.1
Pygments==2.10.0
gssapi==1.7.2
dataclasses==0.8; python_version<"3.7"
async_generator==1.10; python_version<"3.7"
gssapi==1.7.3
async-timeout==4.0.1
zstandard==0.16.0
2 changes: 1 addition & 1 deletion requirements-cython.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Cython==0.29.24
Cython==0.29.30
11 changes: 5 additions & 6 deletions requirements-win-test.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
-r requirements-cython.txt
flake8==4.0.1
black==22.3.0
mypy==0.910
mypy==0.961
isort[colors]==5.10.0
pytest==6.1.2
pytest==7.1.2
pytest-cov==3.0.0
pytest-asyncio==0.16.0
pytest-asyncio==0.18.3
docker==5.0.3
chardet==4.0.0 # Until fixed requests is released
lz4==3.1.3
xxhash==2.0.2
python-snappy==0.6.0
dataclasses==0.8; python_version<"3.7"
async_generator==1.10; python_version<"3.7"
python-snappy==0.6.1
zstandard==0.16.0
10 changes: 2 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import platform
import re
import sys

from setuptools import Extension, setup
from setuptools.command.bdist_rpm import bdist_rpm as _bdist_rpm
Expand Down Expand Up @@ -114,15 +113,9 @@ def build_extension(self, ext):
install_requires = [
"async-timeout",
"kafka-python>=2.0.2",
"dataclasses>=0.5; python_version<'3.7'",
"packaging",
]

PY_VER = sys.version_info

if PY_VER < (3, 6):
raise RuntimeError("aiokafka doesn't support Python earlier than 3.6")


def read(f):
return open(os.path.join(os.path.dirname(__file__), f)).read().strip()
Expand Down Expand Up @@ -153,10 +146,10 @@ def read_version():
"License :: OSI Approved :: Apache Software License",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Operating System :: OS Independent",
"Topic :: System :: Networking",
"Topic :: System :: Distributed Computing",
Expand All @@ -181,6 +174,7 @@ def read_version():
download_url="https://pypi.python.org/pypi/aiokafka",
license="Apache 2",
packages=["aiokafka"],
python_requires=">=3.7",
install_requires=install_requires,
extras_require=extras_require,
include_package_data=True,
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def ssl_folder(docker_ip_address, docker, kafka_image):

container = docker.containers.run(
image=kafka_image,
command="sleep 120",
command="sleep 300",
volumes={
pathlib.Path("gen-ssl-certs.sh").resolve(): {
"bind": "/gen-ssl-certs.sh",
Expand Down
5 changes: 1 addition & 4 deletions tests/test_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ def test_fetch_result_and_error(loop):

# Python3.7 got rid of trailing comma in exceptions, which makes the line
# different between 3.6 and 3.7.
assert repr(error) in [
"<FetchError error=OffsetOutOfRangeError({},)>",
"<FetchError error=OffsetOutOfRangeError({})>"
]
assert repr(error) == "<FetchError error=OffsetOutOfRangeError({})>"


@pytest.mark.usefixtures('setup_test_class_serverless')
Expand Down
3 changes: 0 additions & 3 deletions tests/test_subscription_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
from aiokafka.structs import TopicPartition
from aiokafka.abc import ConsumerRebalanceListener

# All test coroutines will be treated as marked.
pytestmark = pytest.mark.asyncio


@pytest.fixture
async def subscription_state():
Expand Down

0 comments on commit 6360747

Please sign in to comment.