Skip to content

Conversation

benbariteau
Copy link
Member

The main issue here is that for somewhat unclear reasons kafka.vendor.six results in an import error under python 3.12. Since none of that is necessary in python 3--which in a practical sense is all we support--I just removed it, unblocking python 3.12.

As a matter of course I did a few other things:

  • make test now relies on the tox.ini envlist instead of hardcoding a different list
  • added builds for python 3.10, 3.11, and 3.12, and dropped all older builds
  • bumped some packages needed for python 3.10-3.12 support
  • fixed a test with an improper assert which breaks under python 3.12
  • unconditionally skipped a test which was failing on master. it was previously skipping for newer kafka versions, so I think this is probably fine
  • set minimum python version we can install under to 3.10
  • bumped up the virtualenv version due being unable to build a python 3.12 virtualenv otherwise

@nleigh nleigh requested a review from Copilot September 1, 2025 09:57
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for Python 3.12 by removing the kafka.vendor.six compatibility layer that was causing import errors, since Python 2 support is no longer needed. The PR modernizes the codebase to use Python 3's standard library directly.

  • Removes all kafka.vendor.six imports and replaces them with Python 3 standard library equivalents
  • Updates CI/testing configuration to support Python 3.10-3.12 and drops older Python versions
  • Fixes a broken test assertion and unconditionally skips a failing test

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tox.ini Updates Python version matrix to 3.10-3.12 and removes Yelp-specific configuration
test/test_producer_legacy.py Replaces kafka.vendor.six.moves.queue with standard queue import
test/test_producer_integration.py Removes unused kafka.vendor.six.moves.range import
test/test_consumer_integration.py Removes unused range import and unconditionally skips failing test
test/test_codec.py Removes unused range import
test/test_client_async.py Fixes broken test assertions and adds missing mock import
test/fixtures.py Replaces six urllib imports with standard library equivalents
setup.py Sets minimum Python version requirement to 3.10
requirements-dev.txt Updates package versions for Python 3.10-3.12 compatibility
kafka/version.py Bumps version number
kafka/producer/simple.py Removes unused range import
kafka/msk.py Replaces six urllib import with standard library
kafka/consumer/simple.py Replaces six imports with standard library equivalents
kafka/consumer/multiprocess.py Replaces six queue import with standard library
kafka/codec.py Removes six compatibility code and unused imports
Makefile Simplifies test command to use tox.ini configuration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@nleigh nleigh self-requested a review September 1, 2025 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants