Skip to content

Commit eb33f61

Browse files
committed
Remove string support in api_version
A long time ago, `api_version` supported strings. That has been deprecated for years in favor of tuples. Time to remove support for the strings.
1 parent 6b66e11 commit eb33f61

File tree

4 files changed

+3
-22
lines changed

4 files changed

+3
-22
lines changed

kafka/consumer/group.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -340,16 +340,6 @@ def __init__(self, *topics, **configs):
340340
self._metrics = Metrics(metric_config, reporters)
341341
# TODO _metrics likely needs to be passed to KafkaClient, etc.
342342

343-
# api_version was previously a str. Accept old format for now
344-
if isinstance(self.config['api_version'], str):
345-
str_version = self.config['api_version']
346-
if str_version == 'auto':
347-
self.config['api_version'] = None
348-
else:
349-
self.config['api_version'] = tuple(map(int, str_version.split('.')))
350-
log.warning('use api_version=%s [tuple] -- "%s" as str is deprecated',
351-
str(self.config['api_version']), str_version)
352-
353343
self._client = KafkaClient(metrics=self._metrics, **self.config)
354344

355345
# Get auto-discovered version from client if necessary

kafka/producer/kafka.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -358,16 +358,6 @@ def __init__(self, **configs):
358358
if self.config['acks'] == 'all':
359359
self.config['acks'] = -1
360360

361-
# api_version was previously a str. accept old format for now
362-
if isinstance(self.config['api_version'], str):
363-
deprecated = self.config['api_version']
364-
if deprecated == 'auto':
365-
self.config['api_version'] = None
366-
else:
367-
self.config['api_version'] = tuple(map(int, deprecated.split('.')))
368-
log.warning('use api_version=%s [tuple] -- "%s" as str is deprecated',
369-
str(self.config['api_version']), deprecated)
370-
371361
# Configure metrics
372362
metrics_tags = {'client-id': self.config['client_id']}
373363
metric_config = MetricConfig(samples=self.config['metrics_num_samples'],

test/test_producer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ def test_end_to_end(kafka_broker, compression):
7373
def test_kafka_producer_gc_cleanup():
7474
gc.collect()
7575
threads = threading.active_count()
76-
producer = KafkaProducer(api_version='0.9') # set api_version explicitly to avoid auto-detection
76+
producer = KafkaProducer(api_version=(0, 9)) # set api_version explicitly to avoid auto-detection
7777
assert threading.active_count() == threads + 1
78-
del(producer)
78+
del producer
7979
gc.collect()
8080
assert threading.active_count() == threads
8181

test/testutil.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
def kafka_versions(*versions):
2323

2424
def construct_lambda(s):
25+
# TODO should this get cleaned up too?
2526
if s[0].isdigit():
2627
op_str = '='
2728
v_str = s

0 commit comments

Comments
 (0)