Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into kip-345
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaherrera committed Nov 29, 2023
2 parents b8b7ffd + d7201c1 commit 140d115
Show file tree
Hide file tree
Showing 40 changed files with 229 additions and 2,888 deletions.
30 changes: 18 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ jobs:
python-version: "3.8"
- name: Prepare C files to include
run: |
python -m pip install --upgrade pip setuptools
python -m pip install --upgrade pip build
python -m pip install -r requirements-cython.txt
# Make sure we install to have all c files to be shiped with bundle
python -m pip install -vv -U . # We set -vv to see compiler exceptions/warnings
- name: Build source package
run: python setup.py sdist
run: python -m build --sdist
- name: Upload source package
uses: actions/upload-artifact@v2
with:
Expand Down Expand Up @@ -51,14 +51,14 @@ jobs:
- name: Build wheels
env:
CIBW_ARCHS_LINUX: ${{matrix.arch}}
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-*
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-*
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
CIBW_BEFORE_BUILD: pip install -r requirements-cython.txt
CIBW_BUILD_VERBOSITY: 2
run: |
python -m pip install --upgrade pip setuptools
python -m pip install --upgrade pip
pip install cibuildwheel
cibuildwheel --output-dir dist
shell: bash
Expand All @@ -74,15 +74,18 @@ jobs:

strategy:
matrix:
# 3.11 excluded due to problems with python-snappy
python: ["3.8", "3.9", "3.10"]
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- python: "3.8"
aiokafka_whl: dist/aiokafka-*-cp38-cp38-win_amd64.whl
- python: "3.9"
aiokafka_whl: dist/aiokafka-*-cp39-cp39-win_amd64.whl
- python: "3.10"
aiokafka_whl: dist/aiokafka-*-cp310-cp310-win_amd64.whl
- python: "3.11"
aiokafka_whl: dist/aiokafka-*-cp311-cp311-win_amd64.whl
- python: "3.12"
aiokafka_whl: dist/aiokafka-*-cp312-cp312-win_amd64.whl

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

strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11"]
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- python: "3.8"
aiokafka_whl: dist/aiokafka-*-cp38-cp38-macosx_10_9_x86_64.whl
Expand All @@ -126,6 +129,8 @@ jobs:
aiokafka_whl: dist/aiokafka-*-cp310-cp310-macosx_10_9_x86_64.whl
- python: "3.11"
aiokafka_whl: dist/aiokafka-*-cp311-cp311-macosx_10_9_x86_64.whl
- python: "3.12"
aiokafka_whl: dist/aiokafka-*-cp312-cp312-macosx_10_9_x86_64.whl

steps:
- uses: actions/checkout@v2
Expand All @@ -139,9 +144,6 @@ jobs:
with:
python-version: ${{ matrix.python }}

- name: Install system dependencies
run: |
brew install snappy
- name: Install python dependencies
run: |
pip install --upgrade pip setuptools wheel
Expand All @@ -160,7 +162,7 @@ jobs:

strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11"]
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- python: "3.8"
aiokafka_whl: dist/aiokafka-*-cp38-cp38-manylinux*_x86_64.whl
Expand All @@ -170,6 +172,8 @@ jobs:
aiokafka_whl: dist/aiokafka-*-cp310-cp310-manylinux*_x86_64.whl
- python: "3.11"
aiokafka_whl: dist/aiokafka-*-cp311-cp311-manylinux*_x86_64.whl
- python: "3.12"
aiokafka_whl: dist/aiokafka-*-cp312-cp312-manylinux*_x86_64.whl

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -217,6 +221,8 @@ jobs:
aiokafka_whl: dist/aiokafka-*-cp310-cp310-manylinux*_aarch64.whl
- pyver: cp311-cp311
aiokafka_whl: dist/aiokafka-*-cp311-cp311-manylinux*_aarch64.whl
- pyver: cp312-cp312
aiokafka_whl: dist/aiokafka-*-cp312-cp312-manylinux*_aarch64.whl

steps:
- uses: actions/checkout@v2
Expand All @@ -236,7 +242,7 @@ jobs:
source .env/bin/activate && \
yum install -y epel-release && \
yum-config-manager --enable epel && \
yum install -y snappy-devel libzstd-devel krb5-devel && \
yum install -y krb5-devel && \
pip install --upgrade pip setuptools wheel && \
pip install -r requirements-ci.txt && \
pip install ${{ matrix.aiokafka_whl }} && \
Expand Down
36 changes: 17 additions & 19 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ jobs:

strategy:
matrix:
# 3.11 excluded due to problems with python-snappy
python: ["3.8", "3.9", "3.10"]
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]

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

strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11"]
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
Expand All @@ -168,10 +167,6 @@ jobs:
restore-keys: |
${{ runner.os }}-py-${{ matrix.python }}-
- name: Install system dependencies
run: |
brew install snappy
- name: Install python dependencies
run: |
pip install --upgrade pip setuptools wheel
Expand Down Expand Up @@ -215,7 +210,7 @@ jobs:
strategy:
matrix:
include:
- python: "3.11"
- python: "3.12"
kafka: "2.8.1"
scala: "2.13"

Expand All @@ -229,39 +224,42 @@ jobs:
- python: "3.10"
kafka: "2.8.1"
scala: "2.13"
- python: "3.11"
kafka: "2.8.1"
scala: "2.13"

# Older brokers against latest python version
- python: "3.11"
- python: "3.12"
kafka: "0.9.0.1"
scala: "2.11"
- python: "3.11"
- python: "3.12"
kafka: "0.10.2.1"
scala: "2.11"
- python: "3.11"
- python: "3.12"
kafka: "0.11.0.3"
scala: "2.12"
- python: "3.11"
- python: "3.12"
kafka: "1.1.1"
scala: "2.12"
- python: "3.11"
- python: "3.12"
kafka: "2.1.1"
scala: "2.12"
- python: "3.11"
- python: "3.12"
kafka: "2.2.2"
scala: "2.12"
- python: "3.11"
- python: "3.12"
kafka: "2.3.1"
scala: "2.12"
- python: "3.11"
- python: "3.12"
kafka: "2.4.1"
scala: "2.12"
- python: "3.11"
- python: "3.12"
kafka: "2.5.1"
scala: "2.12"
- python: "3.11"
- python: "3.12"
kafka: "2.6.3"
scala: "2.12"
- python: "3.11"
- python: "3.12"
kafka: "2.7.2"
scala: "2.13"
fail-fast: false
Expand Down
21 changes: 21 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@
Changelog
=========

0.9.0 (????-??-??)
==================

New features:

* Include `kafka-python` into `aiokafka`'s code base
* Replace `python-snappy` and `zstandard` with `cramjam`
* PEP518 compliant `pyproject.toml`
* Python 3.12 support


Bugfixes:

* Fix type annotation for `ConsumerRecord` (pr #912 by @zschumacher)
* Improve send performance (issue #943)


Improved Documentation:

* Fix `AbstractTokenProvider.token` example (pr #919 by @mtomilov)


0.8.1 (2023-05-31)
==================
Expand Down
2 changes: 1 addition & 1 deletion aiokafka/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.8.1' # noqa
__version__ = '0.9.0.rc1' # noqa

from .abc import ConsumerRebalanceListener
from .client import AIOKafkaClient
Expand Down
12 changes: 6 additions & 6 deletions aiokafka/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,25 +626,25 @@ async def _wait_on_metadata(self, topic):
UnknownTopicOrPartitionError: if no topic or partitions found
in cluster metadata
"""
if topic in self.cluster.topics():
return self.cluster.partitions_for_topic(topic)
partitions = self.cluster.partitions_for_topic(topic)
if partitions is not None:
return partitions

# add topic to metadata topic list if it is not there already.
self.add_topic(topic)

t0 = time.monotonic()
while True:
await self.force_metadata_update()
if topic in self.cluster.topics():
break
partitions = self.cluster.partitions_for_topic(topic)
if partitions is not None:
return partitions
if (time.monotonic() - t0) > (self._request_timeout_ms / 1000):
raise UnknownTopicOrPartitionError()
if topic in self.cluster.unauthorized_topics:
raise Errors.TopicAuthorizationFailedError(topic)
await asyncio.sleep(self._retry_backoff)

return self.cluster.partitions_for_topic(topic)

async def _maybe_wait_metadata(self):
if self._md_update_fut is not None:
await asyncio.shield(self._md_update_fut)
Expand Down
Loading

0 comments on commit 140d115

Please sign in to comment.