Skip to content

Commit

Permalink
librdkafka and confluent-kafka-python v2.3.0rc3 (#1656)
Browse files Browse the repository at this point in the history
  • Loading branch information
emasab committed Oct 21, 2023
1 parent 9c46e6c commit 8b8c3db
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
######################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/docker/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 3 additions & 3 deletions src/confluent_kafka/_util/conversion_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions src/confluent_kafka/admin/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
14 changes: 7 additions & 7 deletions src/confluent_kafka/src/confluent_kafka.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,28 @@
* 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
* build-time (just below) and runtime (see confluent_kafka.c).
* 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

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/admin/test_incremental_alter_configs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from confluent_kafka.admin import ConfigResource,\
ConfigEntry, ResourceType,\
from confluent_kafka.admin import ConfigResource, \
ConfigEntry, ResourceType, \
AlterConfigOpType


Expand Down
2 changes: 1 addition & 1 deletion tests/test_Consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
Expand Down
2 changes: 1 addition & 1 deletion tests/test_Producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 8b8c3db

Please sign in to comment.