Skip to content

Commit 6b66e11

Browse files
authored
Update docs for api_version_auto_timeout_ms (#1812)
The docs for `api_version_auto_timeout_ms` mention setting `api_version='auto'` but that value has been deprecated for years in favor of `api_version=None`. Updating the docs for now, and will remove support for `'auto'` in next major version bump.
1 parent 1a0f297 commit 6b66e11

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

kafka/consumer/group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ class KafkaConsumer(six.Iterator):
209209
Default: None
210210
api_version_auto_timeout_ms (int): number of milliseconds to throw a
211211
timeout exception from the constructor when checking the broker
212-
api version. Only applies if api_version set to 'auto'
212+
api version. Only applies if api_version set to None.
213213
connections_max_idle_ms: Close idle connections after the number of
214214
milliseconds specified by this config. The broker closes idle
215215
connections after connections.max.idle.ms, so this avoids hitting

kafka/producer/kafka.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ class KafkaProducer(object):
255255
various APIs. Example: (0, 10, 2). Default: None
256256
api_version_auto_timeout_ms (int): number of milliseconds to throw a
257257
timeout exception from the constructor when checking the broker
258-
api version. Only applies if api_version set to 'auto'
258+
api version. Only applies if api_version set to None.
259259
metric_reporters (list): A list of classes to use as metrics reporters.
260260
Implementing the AbstractMetricsReporter interface allows plugging
261261
in classes that will be notified of new metric creation. Default: []

test/fixtures.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,17 @@
2626
def random_string(length):
2727
return "".join(random.choice(string.ascii_letters) for i in range(length))
2828

29-
def version_str_to_list(version_str):
30-
return tuple(map(int, version_str.split('.'))) # e.g., (0, 8, 1, 1)
29+
def version_str_to_tuple(version_str):
30+
"""Transform a version string into a tuple.
31+
32+
Example: '0.8.1.1' --> (0, 8, 1, 1)
33+
"""
34+
return tuple(map(int, version_str.split('.')))
3135

3236
def version():
3337
if 'KAFKA_VERSION' not in os.environ:
3438
return ()
35-
return version_str_to_list(os.environ['KAFKA_VERSION'])
39+
return version_str_to_tuple(os.environ['KAFKA_VERSION'])
3640

3741
def get_open_port():
3842
sock = socket.socket()

test/testutil.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
FailedPayloadsError
1717
)
1818
from kafka.structs import OffsetRequestPayload
19-
from test.fixtures import random_string, version_str_to_list, version as kafka_version #pylint: disable=wrong-import-order
19+
from test.fixtures import random_string, version_str_to_tuple, version as kafka_version #pylint: disable=wrong-import-order
2020

2121

2222
def kafka_versions(*versions):
@@ -43,7 +43,7 @@ def construct_lambda(s):
4343
'<=': operator.le
4444
}
4545
op = op_map[op_str]
46-
version = version_str_to_list(v_str)
46+
version = version_str_to_tuple(v_str)
4747
return lambda a: op(a, version)
4848

4949
validators = map(construct_lambda, versions)

0 commit comments

Comments
 (0)