Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 25 additions & 23 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ global_job_config:
- checkout
- mkdir artifacts
blocks:
- name: "Wheels: OSX x64 - Python 3.8-3.12"
- name: "Wheels: OSX x64 - Python 3.9-3.12"
run:
when: "tag =~ '.*'"
dependencies:
Expand All @@ -35,7 +35,7 @@ blocks:
- PIP_INSTALL_OPTIONS="--user" tools/wheels/build-wheels.sh "${LIBRDKAFKA_VERSION#v}" wheelhouse 2.16.2
- tar -czf wheelhouse-macOS-${ARCH}.tgz wheelhouse
- artifact push workflow wheelhouse-macOS-${ARCH}.tgz --destination artifacts/wheels-${OS_NAME}-${ARCH}.tgz/
- name: "Wheels: OSX x64 - Python 3.13-3.14"
- name: "Wheels: OSX x64 - Python 3.13-3.15"
run:
when: "tag =~ '.*'"
dependencies:
Expand All @@ -48,7 +48,7 @@ blocks:
- name: OS_NAME
value: osx
- name: CIBW_SKIP
value: cp36-* cp37-* cp38-* cp39-* cp310-* cp311-* cp312-*
value: cp39-* cp310-* cp311-* cp312-*
- name: CIBW_ENVIRONMENT_MACOS
value: MACOSX_DEPLOYMENT_TARGET=13
jobs:
Expand All @@ -60,7 +60,7 @@ blocks:
- PIP_INSTALL_OPTIONS="--user" tools/wheels/build-wheels.sh "${LIBRDKAFKA_VERSION#v}" wheelhouse
- tar -czf wheelhouse-macOS-${ARCH}-py313-plus.tgz wheelhouse
- artifact push workflow wheelhouse-macOS-${ARCH}-py313-plus.tgz --destination artifacts/wheels-${OS_NAME}-${ARCH}-py313-plus.tgz/
- name: "Wheels: OSX arm64 - Python 3.8-3.12"
- name: "Wheels: OSX arm64 - Python 3.9-3.12"
run:
when: "tag =~ '.*'"
dependencies:
Expand All @@ -83,7 +83,7 @@ blocks:
- PIP_INSTALL_OPTIONS="--user" tools/wheels/build-wheels.sh "${LIBRDKAFKA_VERSION#v}" wheelhouse 2.16.2
- tar -czf wheelhouse-macOS-${ARCH}.tgz wheelhouse
- artifact push workflow wheelhouse-macOS-${ARCH}.tgz --destination artifacts/wheels-${OS_NAME}-${ARCH}.tgz/
- name: "Wheels: OSX arm64 - Python 3.13-3.14"
- name: "Wheels: OSX arm64 - Python 3.13-3.15"
run:
when: "tag =~ '.*'"
dependencies:
Expand All @@ -98,7 +98,7 @@ blocks:
- name: CIBW_ARCHS
value: arm64
- name: CIBW_SKIP
value: cp38-* cp39-* cp310-* cp311-* cp312-*
value: cp39-* cp310-* cp311-* cp312-*
- name: CIBW_ENVIRONMENT_MACOS
value: MACOSX_DEPLOYMENT_TARGET=13
jobs:
Expand Down Expand Up @@ -254,7 +254,7 @@ blocks:
- cp test-report.xml test-output
- test-results publish test-output
- artifact push workflow coverage.xml
- name: "Source package verification and Integration tests with Python 3.14t free-threaded (Linux x64)"
- name: "Source package verification and Integration tests with Python 3.15t free-threaded (Linux x64)"
dependencies: []
task:
agent:
Expand All @@ -274,15 +274,15 @@ blocks:
- sem-version python 3.11
- sem-version java 17
- pip install uv
- uv venv _venv --python 3.14t && source _venv/bin/activate
- uv venv _venv --python 3.15t && source _venv/bin/activate
- chmod u+r+x tools/source-package-verification.sh
- tools/source-package-verification.sh
- name: Build and Tests with 'consumer' group protocol
commands:
- sem-version python 3.11
- sem-version java 17
- pip install uv
- uv venv _venv --python 3.14t && source _venv/bin/activate
- uv venv _venv --python 3.15t && source _venv/bin/activate
- chmod u+r+x tools/source-package-verification.sh
- export TEST_CONSUMER_GROUP_PROTOCOL=consumer
- tools/source-package-verification.sh
Expand Down Expand Up @@ -467,7 +467,7 @@ blocks:
- name: Verify free threaded
commands:
- export ARCH=x64
# sem-version only provides a pip to bootstrap uv; the wheel runs in the 3.14t venv uv creates.
# sem-version only provides a pip to bootstrap uv; the wheel runs in the 3.15t venv uv creates.
- sem-version python 3.9
- pip install uv
- tools/verify-free-threaded-job.sh
Expand All @@ -494,7 +494,7 @@ blocks:
- name: Verify free threaded
commands:
- export ARCH=arm64
# sem-version only provides a pip to bootstrap uv; the wheel runs in the 3.14t venv uv creates.
# sem-version only provides a pip to bootstrap uv; the wheel runs in the 3.15t venv uv creates.
- sem-version python 3.9
- pip install uv
- tools/verify-free-threaded-job.sh
Expand All @@ -521,16 +521,16 @@ blocks:
- name: Verify free threaded
commands:
- export ARCH=s390x
# sem-version only provides a pip to bootstrap uv; the wheel runs in the 3.14t venv uv creates.
# sem-version only provides a pip to bootstrap uv; the wheel runs in the 3.15t venv uv creates.
- sem-version python 3.13
- pip install uv
- tools/verify-free-threaded-job.sh
- name: "Wheel Verification: OSX x64"
run:
when: "tag =~ '.*'"
dependencies:
- "Wheels: OSX x64 - Python 3.8-3.12"
- "Wheels: OSX x64 - Python 3.13-3.14"
- "Wheels: OSX x64 - Python 3.9-3.12"
- "Wheels: OSX x64 - Python 3.13-3.15"
task:
agent:
machine:
Expand Down Expand Up @@ -560,16 +560,16 @@ blocks:
- name: Verify free threaded
commands:
- export ARCH=x64
# sem-version only provides a pip to bootstrap uv; the wheel runs in the 3.14t venv uv creates.
# sem-version only provides a pip to bootstrap uv; the wheel runs in the 3.15t venv uv creates.
- sem-version python 3.11
- pip install uv
- tools/verify-free-threaded-job.sh
- name: "Wheel Verification: OSX arm64"
run:
when: "tag =~ '.*'"
dependencies:
- "Wheels: OSX arm64 - Python 3.8-3.12"
- "Wheels: OSX arm64 - Python 3.13-3.14"
- "Wheels: OSX arm64 - Python 3.9-3.12"
- "Wheels: OSX arm64 - Python 3.13-3.15"
task:
agent:
machine:
Expand Down Expand Up @@ -599,7 +599,7 @@ blocks:
- name: Verify free threaded
commands:
- export ARCH=arm64
# sem-version only provides a pip to bootstrap uv; the wheel runs in the 3.14t venv uv creates.
# sem-version only provides a pip to bootstrap uv; the wheel runs in the 3.15t venv uv creates.
- sem-version python 3.11
- pip install uv
- tools/verify-free-threaded-job.sh
Expand Down Expand Up @@ -637,24 +637,26 @@ blocks:
- pytest tests\test_error.py
- name: Verify free threaded
commands:
# sem-version only provides a pip to bootstrap uv; the wheel runs in the 3.14t venv uv creates.
# sem-version only provides a pip to bootstrap uv; the wheel runs in the 3.15t venv uv creates.
- sem-version python 3.11
- python -m pip install uv
- uv venv _venv314t --python 3.14t
- . .\_venv314t\Scripts\Activate.ps1
# python -m uv: the uv just installed, not the image's (see tools/verify-free-threaded-job.sh).
- python -m uv venv _venv315t --python 3.15t
- . .\_venv315t\Scripts\Activate.ps1
- python -c "import sys; print(sys.version); sys.exit(sys.version_info.releaselevel != 'final')"
- python -m ensurepip
- python -m pip install -r requirements/requirements-tests-install-nogil.txt
- artifact pull workflow artifacts
- python -c "import glob, sys; found = glob.glob('artifacts/*.tgz'); print(found); sys.exit(0 if found else 1)"
- cd artifacts
- Get-ChildItem *.tgz | ForEach-Object { tar -xf $_.Name }
- cd ..
- python -c "import glob, sys; found = glob.glob('artifacts/wheelhouse/*-cp314t-win_amd64.whl'); print(found); sys.exit(0 if found else 1)"
- python -c "import glob, sys; found = glob.glob('artifacts/wheelhouse/*-cp315t-win_amd64.whl'); print(found); sys.exit(0 if found else 1)"
- python -m pip install --no-index --find-links artifacts\wheelhouse confluent-kafka
- ".\\tools\\mingw-w64\\setup-msys2.ps1"
# The Windows librdkafka build has no git tag in its version string (2.16.0, not 2.16.0-RC2)
# FIXME: add LIBRDKAFKA_GIT_VERSION when building Windows as well.
- C:\msys64\usr\bin\bash.exe -c 'LIBRDKAFKA_VERSION=${LIBRDKAFKA_VERSION%%-*} tools/verify-free-threaded-wheel.sh _venv314t/Scripts/python.exe'
- C:\msys64\usr\bin\bash.exe -c 'LIBRDKAFKA_VERSION=${LIBRDKAFKA_VERSION%%-*} tools/verify-free-threaded-wheel.sh _venv315t/Scripts/python.exe'
- python -m pytest tests --ignore=tests\integration --ignore=tests\test_unasync.py --timeout 1200
- name: "Pre-release Validation"
run:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## Unreleased

### Enhancements

- Add Python 3.15 and 3.15t (free-threaded) wheels. The `rules` extra
(CSFLE and data quality rules) can't be installed on Python 3.15 yet, as
its `tink` and `google-re2` dependencies publish no Python 3.15 wheels (#2406)
- Drop Python 3.8 support. Python 3.8 reached end of life in October 2024 (#2406)

### Fixes
- Fix `AvroDeserializer` rejecting messages of 5 bytes or fewer when the schema GUID is
sent in a header (`header_schema_id_serializer`), for example `int` keys or short
Expand Down
2 changes: 1 addition & 1 deletion DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This document provides information useful to developers working on confluent-kaf

### Prerequisites

- Python 3.8 or higher
- Python 3.9 or higher
- Git
- librdkafka (for Kafka functionality)

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ classifiers = [
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Libraries :: Python Modules"]
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.9"
dynamic = ["dependencies", "optional-dependencies"]

[[project.authors]]
Expand Down Expand Up @@ -55,7 +55,7 @@ follow_imports = "skip"

[tool.black]
line-length = 120
target-version = ['py38', 'py39', 'py310', 'py311', 'py312', 'py313']
target-version = ['py39', 'py310', 'py311', 'py312', 'py313']
skip-string-normalization = true
include = '\.pyi?$'
extend-exclude = '''
Expand Down
2 changes: 1 addition & 1 deletion service.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: confluent-kafka-python
lang: python
lang_version: '3.8'
lang_version: '3.9'
git:
enable: true
sonarqube:
Expand Down
7 changes: 4 additions & 3 deletions tests/schema_registry/test_json_schema_retrieve.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ def test_retrieve_via_httpx_allows_public_host():
def gai(host, port, *args, **kwargs):
return [(2, 1, 6, "", ("93.184.216.34", port))]

with mock.patch.object(json_schema.socket, "getaddrinfo", side_effect=gai), mock.patch.object(
json_schema.httpx, "get", return_value=response
) as get:
with (
mock.patch.object(json_schema.socket, "getaddrinfo", side_effect=gai),
mock.patch.object(json_schema.httpx, "get", return_value=response) as get,
):
json_schema._retrieve_via_httpx("http://schemas.example.com/draft-07/schema")
get.assert_called_once()
2 changes: 1 addition & 1 deletion tools/build-manylinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# docker run -t -v $(pwd):/io quay.io/pypa/manylinux2010_x86_64:latest /io/tools/build-manylinux.sh <librdkafka_tag>

LIBRDKAFKA_VERSION=$1
PYTHON_VERSIONS=("cp37" "cp38" "cp39" "cp310" "cp311" "cp312" "cp313")
PYTHON_VERSIONS=("cp39" "cp310" "cp311" "cp312" "cp313")

if [[ -z "$LIBRDKAFKA_VERSION" ]]; then
echo "Usage: $0 <librdkafka_tag>"
Expand Down
6 changes: 1 addition & 5 deletions tools/mingw-w64/semaphore_commands.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#!/bin/bash
$msys2 pacman -S python --version 3.8.0

set -e

export PATH="$PATH;C:\Python38;C:\Python38\Scripts"
export MAKE=mingw32-make # so that Autotools can find it

cmd /c mklink /D C:\Python38\python3.exe C:\Python38\python.exe

python -m pip install cibuildwheel==3.2.1
python -m pip install cibuildwheel==4.3.5
2 changes: 1 addition & 1 deletion tools/requirements-manylinux.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cibuildwheel==3.2.1
cibuildwheel==4.3.5
wheel
9 changes: 1 addition & 8 deletions tools/test-released-wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [[ -z "$1" ]]; then
fi

# List of Python versions to run the code with
python_versions=("3.8" "3.9" "3.10" "3.11" "3.12" "3.13" "3.14")
python_versions=("3.9" "3.10" "3.11" "3.12" "3.13" "3.14" "3.15")

if command -v sem-version &> /dev/null; then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know if sem-version python 3.15 is supported, since it is a new version? If it is not, then post release verification will fail for 3.15.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you able to check this?

use_sem_version=true
Expand All @@ -25,13 +25,6 @@ fi

# Loop through each Python version and execute the code
for version in "${python_versions[@]}"; do
if [ "$version" = "3.8" ]; then
export MISE_PYTHON_GITHUB_ATTESTATIONS=false
else
# Attestation verification is available for Python versions >= 3.10
unset MISE_PYTHON_GITHUB_ATTESTATIONS
fi

echo -e "\e[1;34mRunning with Python version $version \e[0m"

if [[ "$use_sem_version" = true ]]; then
Expand Down
29 changes: 18 additions & 11 deletions tools/verify-free-threaded-job.sh

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned before, let's verify only for 3.15.

Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/bash
#
# Body of the "Verify free threaded" job in the Linux and macOS Wheel
# Verification blocks of .semaphore/semaphore.yml: install the cp314t wheel,
# Verification blocks of .semaphore/semaphore.yml: install the cp315t wheel,
# run the free-threaded wheel checks (tools/verify-free-threaded-wheel.sh) and then the unit suite.
#
# Run from the repo root with uv on PATH. Expects OS_NAME (linux|osx) and ARCH
# Run from the repo root with the uv package installed in the active python
# (`pip install uv`). Expects OS_NAME (linux|osx) and ARCH
# (x64|arm64, or s390x on linux) as the Wheel blocks set them, and
# LIBRDKAFKA_VERSION for the wheel checks.

Expand All @@ -16,11 +17,11 @@ set -eu
# cibuildwheel tags Linux wheels manylinux_*_{x86_64,aarch64,s390x} and macOS
# wheels macosx_*_{x86_64,arm64}.
case "$OS_NAME-$ARCH" in
linux-x64) wheel_glob='*-cp314t-manylinux*x86_64.whl' ;;
linux-arm64) wheel_glob='*-cp314t-manylinux*aarch64.whl' ;;
linux-s390x) wheel_glob='*-cp314t-manylinux*s390x.whl' ;;
osx-x64) wheel_glob='*-cp314t-macosx*x86_64.whl' ;;
osx-arm64) wheel_glob='*-cp314t-macosx*arm64.whl' ;;
linux-x64) wheel_glob='*-cp315t-manylinux*x86_64.whl' ;;
linux-arm64) wheel_glob='*-cp315t-manylinux*aarch64.whl' ;;
linux-s390x) wheel_glob='*-cp315t-manylinux*s390x.whl' ;;
osx-x64) wheel_glob='*-cp315t-macosx*x86_64.whl' ;;
osx-arm64) wheel_glob='*-cp315t-macosx*arm64.whl' ;;
*) echo "$0: unsupported OS_NAME-ARCH '$OS_NAME-$ARCH'" >&2; exit 1 ;;
esac
echo "Verifying the free-threaded wheel matching $wheel_glob for $OS_NAME-$ARCH"
Expand All @@ -34,17 +35,23 @@ else
tests_install_reqs=requirements/requirements-tests-install-nogil.txt
fi

uv venv _venv314t --python 3.14t
source _venv314t/bin/activate
uv pip install -r "$tests_install_reqs"
# Use the uv that `pip install uv` just installed, not the first uv on PATH: the
# macOS and s390x agent images ship uv 0.11.17, which only knows 3.15.0b1 for 3.15t.
uv=$(python -c 'from uv import find_uv_bin; print(find_uv_bin())')
"$uv" --version

"$uv" venv _venv315t --python 3.15t
source _venv315t/bin/activate
python -c 'import sys; print(sys.version); sys.exit(sys.version_info.releaselevel != "final")'
"$uv" pip install -r "$tests_install_reqs"

artifact pull workflow artifacts
# Fail fast, with a clear message, if the pull brought no wheel tarballs at all.
ls artifacts/*.tgz
(cd artifacts && ls *.tgz | xargs -n1 tar -xvf)
# Unquoted on purpose: the glob must expand, and ls fails if nothing matches.
ls artifacts/wheelhouse/$wheel_glob
uv pip install --no-index --find-links artifacts/wheelhouse confluent-kafka
"$uv" pip install --no-index --find-links artifacts/wheelhouse confluent-kafka

tools/verify-free-threaded-wheel.sh
python -m pytest tests/ --ignore=tests/integration --ignore=tests/test_unasync.py --timeout 1200
2 changes: 1 addition & 1 deletion tools/verify-free-threaded-wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Verify an installed free-threaded (cp3XXt) confluent-kafka wheel.
#
# Usage: tools/verify-free-threaded-wheel.sh [python]
# python interpreter to check with; defaults to "python", i.e. the activated 3.14t venv.
# python interpreter to check with; defaults to "python", i.e. the activated 3.15t venv.
#
# Expects the wheel to be installed already and LIBRDKAFKA_VERSION (e.g. v2.15.0)
# to name the librdkafka it must bundle. Exits non-zero on the first failed check.
Expand Down
2 changes: 1 addition & 1 deletion tools/wheels/build-wheels.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ set WHEELHOUSE=%4
if [%WHEELHOUSE%]==[] goto usage
echo on

set CIBW_BUILD=cp38-%BW_ARCH% cp39-%BW_ARCH% cp310-%BW_ARCH% cp311-%BW_ARCH% cp312-%BW_ARCH% cp313-%BW_ARCH% cp314-%BW_ARCH% cp314t-%BW_ARCH%
set CIBW_BUILD=cp39-%BW_ARCH% cp310-%BW_ARCH% cp311-%BW_ARCH% cp312-%BW_ARCH% cp313-%BW_ARCH% cp314-%BW_ARCH% cp314t-%BW_ARCH% cp315-%BW_ARCH% cp315t-%BW_ARCH%
set CIBW_BEFORE_BUILD=python -m pip install delvewheel==1.10.0
set CIBW_TEST_REQUIRES=pytest
set CIBW_TEST_COMMAND=pytest {project}\tests\test_error.py
Expand Down
9 changes: 6 additions & 3 deletions tools/wheels/build-wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
this_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"


# Skip PyPy, Python2, old Python3 versions, musl, x86 builds and free threaded 3.13 build.
export CIBW_SKIP="pp* cp27-* cp35-* cp36-* *i686 *musllinux* cp313t-* $CIBW_SKIP"
# Skip PyPy, Pythons older than 3.9, musl and x86 builds. cibuildwheel 4.x no
# longer knows cp36-cp38 and builds PyPy only when enabled (it warns about
# these patterns), but the 2.x used for the macOS 3.9-3.12 wheels and
# install-macos-python-required-by-cibuildwheel.py need them.
export CIBW_SKIP="pp* cp36-* cp37-* cp38-* *i686 *musllinux* $CIBW_SKIP"
# Run a simple test suite
export CIBW_TEST_REQUIRES="pytest"
export CIBW_TEST_COMMAND="pytest {project}/tests/test_error.py"
Expand All @@ -17,7 +20,7 @@ export CIBW_MANYLINUX_S390X_IMAGE="manylinux_2_28"

librdkafka_version=$1
wheeldir=$2
cibuildwheel_version=${3:-"3.2.1"}
cibuildwheel_version=${3:-"4.3.5"}

if [[ -z $wheeldir ]]; then
echo "Usage: $0 <librdkafka-nuget-version> <wheeldir>"
Expand Down
Loading