From 8b8c3db0ccb1276a34eb3d77bc9332afca008e20 Mon Sep 17 00:00:00 2001 From: Emanuele Sabellico Date: Thu, 19 Oct 2023 09:42:44 +0200 Subject: [PATCH] librdkafka and confluent-kafka-python v2.3.0rc3 (#1656) --- .semaphore/semaphore.yml | 2 +- docs/conf.py | 2 +- examples/docker/Dockerfile.alpine | 2 +- setup.py | 2 +- src/confluent_kafka/_util/conversion_util.py | 6 +++--- src/confluent_kafka/admin/_config.py | 4 ++-- src/confluent_kafka/src/confluent_kafka.h | 14 +++++++------- .../admin/test_incremental_alter_configs.py | 4 ++-- tests/test_Consumer.py | 2 +- tests/test_Producer.py | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index e04e8e139..81aca1377 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -8,7 +8,7 @@ execution_time_limit: global_job_config: env_vars: - name: LIBRDKAFKA_VERSION - value: v2.2.0 + value: v2.3.0-RC3 prologue: commands: - checkout diff --git a/docs/conf.py b/docs/conf.py index 1ef076576..0783256cc 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -35,7 +35,7 @@ # built documents. # # The short X.Y version. -version = '2.2.0' +version = '2.3.0rc3' # The full version, including alpha/beta/rc tags. release = version ###################################################################### diff --git a/examples/docker/Dockerfile.alpine b/examples/docker/Dockerfile.alpine index 13361a0ce..2273428b5 100644 --- a/examples/docker/Dockerfile.alpine +++ b/examples/docker/Dockerfile.alpine @@ -30,7 +30,7 @@ FROM alpine:3.12 COPY . /usr/src/confluent-kafka-python -ENV LIBRDKAFKA_VERSION v2.2.0 +ENV LIBRDKAFKA_VERSION v2.3.0-RC3 ENV KAFKACAT_VERSION master diff --git a/setup.py b/setup.py index c5d3e1c27..95b153eef 100755 --- a/setup.py +++ b/setup.py @@ -75,7 +75,7 @@ def get_install_requirements(path): setup(name='confluent-kafka', # Make sure to bump CFL_VERSION* in confluent_kafka/src/confluent_kafka.h # and version in docs/conf.py. - version='2.2.0', + version='2.3.0rc3', description='Confluent\'s Python client for Apache Kafka', author='Confluent Inc', author_email='support@confluent.io', diff --git a/src/confluent_kafka/_util/conversion_util.py b/src/confluent_kafka/_util/conversion_util.py index 82c9b7018..9f28e0c43 100644 --- a/src/confluent_kafka/_util/conversion_util.py +++ b/src/confluent_kafka/_util/conversion_util.py @@ -21,18 +21,18 @@ def convert_to_enum(val, enum_clazz): if type(enum_clazz) is not type(Enum): raise TypeError("'enum_clazz' must be of type Enum") - if type(val) == str: + if isinstance(val, str): # Allow it to be specified as case-insensitive string, for convenience. try: val = enum_clazz[val.upper()] except KeyError: raise ValueError("Unknown value \"%s\": should be a %s" % (val, enum_clazz.__name__)) - elif type(val) == int: + elif isinstance(val, int): # The C-code passes restype as an int, convert to enum. val = enum_clazz(val) - elif type(val) != enum_clazz: + elif not isinstance(val, enum_clazz): raise TypeError("Unknown value \"%s\": should be a %s" % (val, enum_clazz.__name__)) return val diff --git a/src/confluent_kafka/admin/_config.py b/src/confluent_kafka/admin/_config.py index 008a18ee1..2c96bfa98 100644 --- a/src/confluent_kafka/admin/_config.py +++ b/src/confluent_kafka/admin/_config.py @@ -146,14 +146,14 @@ def __init__(self, restype, name, if name is None: raise ValueError("Expected resource name to be a string") - if type(restype) == str: + if isinstance(restype, str): # Allow resource type to be specified as case-insensitive string, for convenience. try: restype = ConfigResource.Type[restype.upper()] except KeyError: raise ValueError("Unknown resource type \"%s\": should be a ConfigResource.Type" % restype) - elif type(restype) == int: + elif isinstance(restype, int): # The C-code passes restype as an int, convert to Type. restype = ConfigResource.Type(restype) diff --git a/src/confluent_kafka/src/confluent_kafka.h b/src/confluent_kafka/src/confluent_kafka.h index 7942a3663..0ae15f4bd 100644 --- a/src/confluent_kafka/src/confluent_kafka.h +++ b/src/confluent_kafka/src/confluent_kafka.h @@ -42,8 +42,8 @@ * 0xMMmmRRPP * MM=major, mm=minor, RR=revision, PP=patchlevel (not used) */ -#define CFL_VERSION 0x02020000 -#define CFL_VERSION_STR "2.2.0" +#define CFL_VERSION 0x02030000 +#define CFL_VERSION_STR "2.3.0rc3" /** * Minimum required librdkafka version. This is checked both during @@ -51,19 +51,19 @@ * Make sure to keep the MIN_RD_KAFKA_VERSION, MIN_VER_ERRSTR and #error * defines and strings in sync. */ -#define MIN_RD_KAFKA_VERSION 0x020200ff +#define MIN_RD_KAFKA_VERSION 0x020300ff #ifdef __APPLE__ -#define MIN_VER_ERRSTR "confluent-kafka-python requires librdkafka v2.2.0 or later. Install the latest version of librdkafka from Homebrew by running `brew install librdkafka` or `brew upgrade librdkafka`" +#define MIN_VER_ERRSTR "confluent-kafka-python requires librdkafka v2.3.0 or later. Install the latest version of librdkafka from Homebrew by running `brew install librdkafka` or `brew upgrade librdkafka`" #else -#define MIN_VER_ERRSTR "confluent-kafka-python requires librdkafka v2.2.0 or later. Install the latest version of librdkafka from the Confluent repositories, see http://docs.confluent.io/current/installation.html" +#define MIN_VER_ERRSTR "confluent-kafka-python requires librdkafka v2.3.0 or later. Install the latest version of librdkafka from the Confluent repositories, see http://docs.confluent.io/current/installation.html" #endif #if RD_KAFKA_VERSION < MIN_RD_KAFKA_VERSION #ifdef __APPLE__ -#error "confluent-kafka-python requires librdkafka v2.2.0 or later. Install the latest version of librdkafka from Homebrew by running `brew install librdkafka` or `brew upgrade librdkafka`" +#error "confluent-kafka-python requires librdkafka v2.3.0 or later. Install the latest version of librdkafka from Homebrew by running `brew install librdkafka` or `brew upgrade librdkafka`" #else -#error "confluent-kafka-python requires librdkafka v2.2.0 or later. Install the latest version of librdkafka from the Confluent repositories, see http://docs.confluent.io/current/installation.html" +#error "confluent-kafka-python requires librdkafka v2.3.0 or later. Install the latest version of librdkafka from the Confluent repositories, see http://docs.confluent.io/current/installation.html" #endif #endif diff --git a/tests/integration/admin/test_incremental_alter_configs.py b/tests/integration/admin/test_incremental_alter_configs.py index 4f279d49c..111e6fc4b 100644 --- a/tests/integration/admin/test_incremental_alter_configs.py +++ b/tests/integration/admin/test_incremental_alter_configs.py @@ -1,5 +1,5 @@ -from confluent_kafka.admin import ConfigResource,\ - ConfigEntry, ResourceType,\ +from confluent_kafka.admin import ConfigResource, \ + ConfigEntry, ResourceType, \ AlterConfigOpType diff --git a/tests/test_Consumer.py b/tests/test_Consumer.py index a939af120..48a8d3f8e 100644 --- a/tests/test_Consumer.py +++ b/tests/test_Consumer.py @@ -185,7 +185,7 @@ def commit_cb(cs, err, ps): def test_subclassing(): class SubConsumer(Consumer): def poll(self, somearg): - assert type(somearg) == str + assert isinstance(somearg, str) super(SubConsumer, self).poll(timeout=0.0001) sc = SubConsumer({"group.id": "test", "session.timeout.ms": "90"}) diff --git a/tests/test_Producer.py b/tests/test_Producer.py index 4c45c5683..7b81d2125 100644 --- a/tests/test_Producer.py +++ b/tests/test_Producer.py @@ -134,7 +134,7 @@ def produce_hi(self): super(SubProducer, self).produce(self.topic, value='hi') sp = SubProducer(dict(), 'atopic') - assert type(sp) == SubProducer + assert isinstance(sp, SubProducer) # Invalid config should fail with pytest.raises(KafkaException):