kafka-python 2.3.0__py2.py3-none-any.whl → 2.3.1__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kafka/codec.py +2 -4
- kafka/consumer/fetcher.py +5 -4
- kafka/coordinator/consumer.py +2 -1
- kafka/protocol/types.py +21 -20
- kafka/version.py +1 -1
- {kafka_python-2.3.0.dist-info → kafka_python-2.3.1.dist-info}/METADATA +11 -14
- {kafka_python-2.3.0.dist-info → kafka_python-2.3.1.dist-info}/RECORD +9 -9
- {kafka_python-2.3.0.dist-info → kafka_python-2.3.1.dist-info}/WHEEL +1 -1
- {kafka_python-2.3.0.dist-info → kafka_python-2.3.1.dist-info}/top_level.txt +0 -0
kafka/codec.py
CHANGED
|
@@ -327,7 +327,5 @@ def zstd_encode(payload):
|
|
|
327
327
|
def zstd_decode(payload):
|
|
328
328
|
if not zstd:
|
|
329
329
|
raise NotImplementedError("Zstd codec is not available")
|
|
330
|
-
|
|
331
|
-
return
|
|
332
|
-
except zstd.ZstdError:
|
|
333
|
-
return zstd.ZstdDecompressor().decompress(payload, max_output_size=ZSTD_MAX_OUTPUT_SIZE)
|
|
330
|
+
with zstd.ZstdDecompressor().stream_reader(io.BytesIO(payload), read_across_frames=True) as reader:
|
|
331
|
+
return reader.read()
|
kafka/consumer/fetcher.py
CHANGED
|
@@ -250,16 +250,17 @@ class Fetcher(six.Iterator):
|
|
|
250
250
|
break
|
|
251
251
|
|
|
252
252
|
if future.succeeded():
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
offsets, retry = future.value
|
|
254
|
+
fetched_offsets.update(offsets)
|
|
255
|
+
if not retry:
|
|
255
256
|
return fetched_offsets
|
|
256
257
|
|
|
257
|
-
timestamps = {tp: timestamps[tp] for tp in
|
|
258
|
+
timestamps = {tp: timestamps[tp] for tp in retry}
|
|
258
259
|
|
|
259
260
|
elif not future.retriable():
|
|
260
261
|
raise future.exception # pylint: disable-msg=raising-bad-type
|
|
261
262
|
|
|
262
|
-
|
|
263
|
+
elif future.exception.invalid_metadata or self._client.cluster.need_update:
|
|
263
264
|
refresh_future = self._client.cluster.request_update()
|
|
264
265
|
self._client.poll(future=refresh_future, timeout_ms=timer.timeout_ms)
|
|
265
266
|
|
kafka/coordinator/consumer.py
CHANGED
|
@@ -457,7 +457,8 @@ class ConsumerCoordinator(BaseCoordinator):
|
|
|
457
457
|
self._client.poll(future=future, timeout_ms=timer.timeout_ms)
|
|
458
458
|
|
|
459
459
|
if future.is_done:
|
|
460
|
-
|
|
460
|
+
if future_key in self._offset_fetch_futures:
|
|
461
|
+
del self._offset_fetch_futures[future_key]
|
|
461
462
|
|
|
462
463
|
if future.succeeded():
|
|
463
464
|
return future.value
|
kafka/protocol/types.py
CHANGED
|
@@ -213,6 +213,17 @@ class Array(AbstractType):
|
|
|
213
213
|
|
|
214
214
|
|
|
215
215
|
class UnsignedVarInt32(AbstractType):
|
|
216
|
+
@classmethod
|
|
217
|
+
def decode(cls, data):
|
|
218
|
+
value = VarInt32.decode(data)
|
|
219
|
+
return (value << 1) ^ (value >> 31)
|
|
220
|
+
|
|
221
|
+
@classmethod
|
|
222
|
+
def encode(cls, value):
|
|
223
|
+
return VarInt32.encode((value >> 1) ^ -(value & 1))
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
class VarInt32(AbstractType):
|
|
216
227
|
@classmethod
|
|
217
228
|
def decode(cls, data):
|
|
218
229
|
value, i = 0, 0
|
|
@@ -225,10 +236,12 @@ class UnsignedVarInt32(AbstractType):
|
|
|
225
236
|
if i > 28:
|
|
226
237
|
raise ValueError('Invalid value {}'.format(value))
|
|
227
238
|
value |= b << i
|
|
228
|
-
return value
|
|
239
|
+
return (value >> 1) ^ -(value & 1)
|
|
229
240
|
|
|
230
241
|
@classmethod
|
|
231
242
|
def encode(cls, value):
|
|
243
|
+
# bring it in line with the java binary repr
|
|
244
|
+
value = (value << 1) ^ (value >> 31)
|
|
232
245
|
value &= 0xffffffff
|
|
233
246
|
ret = b''
|
|
234
247
|
while (value & 0xffffff80) != 0:
|
|
@@ -239,25 +252,12 @@ class UnsignedVarInt32(AbstractType):
|
|
|
239
252
|
return ret
|
|
240
253
|
|
|
241
254
|
|
|
242
|
-
class VarInt32(AbstractType):
|
|
243
|
-
@classmethod
|
|
244
|
-
def decode(cls, data):
|
|
245
|
-
value = UnsignedVarInt32.decode(data)
|
|
246
|
-
return (value >> 1) ^ -(value & 1)
|
|
247
|
-
|
|
248
|
-
@classmethod
|
|
249
|
-
def encode(cls, value):
|
|
250
|
-
# bring it in line with the java binary repr
|
|
251
|
-
value &= 0xffffffff
|
|
252
|
-
return UnsignedVarInt32.encode((value << 1) ^ (value >> 31))
|
|
253
|
-
|
|
254
|
-
|
|
255
255
|
class VarInt64(AbstractType):
|
|
256
256
|
@classmethod
|
|
257
257
|
def decode(cls, data):
|
|
258
258
|
value, i = 0, 0
|
|
259
259
|
while True:
|
|
260
|
-
b = data.read(1)
|
|
260
|
+
b, = struct.unpack('B', data.read(1))
|
|
261
261
|
if not (b & 0x80):
|
|
262
262
|
break
|
|
263
263
|
value |= (b & 0x7f) << i
|
|
@@ -270,14 +270,14 @@ class VarInt64(AbstractType):
|
|
|
270
270
|
@classmethod
|
|
271
271
|
def encode(cls, value):
|
|
272
272
|
# bring it in line with the java binary repr
|
|
273
|
+
value = (value << 1) ^ (value >> 63)
|
|
273
274
|
value &= 0xffffffffffffffff
|
|
274
|
-
v = (value << 1) ^ (value >> 63)
|
|
275
275
|
ret = b''
|
|
276
|
-
while (
|
|
276
|
+
while (value & 0xffffffffffffff80) != 0:
|
|
277
277
|
b = (value & 0x7f) | 0x80
|
|
278
278
|
ret += struct.pack('B', b)
|
|
279
|
-
|
|
280
|
-
ret += struct.pack('B',
|
|
279
|
+
value >>= 7
|
|
280
|
+
ret += struct.pack('B', value)
|
|
281
281
|
return ret
|
|
282
282
|
|
|
283
283
|
|
|
@@ -322,8 +322,9 @@ class TaggedFields(AbstractType):
|
|
|
322
322
|
for k, v in value.items():
|
|
323
323
|
# do we allow for other data types ?? It could get complicated really fast
|
|
324
324
|
assert isinstance(v, bytes), 'Value {} is not a byte array'.format(v)
|
|
325
|
-
assert isinstance(k, int) and k
|
|
325
|
+
assert isinstance(k, int) and k >= 0, 'Key {} is not a non-negative integer'.format(k)
|
|
326
326
|
ret += UnsignedVarInt32.encode(k)
|
|
327
|
+
ret += UnsignedVarInt32.encode(len(v))
|
|
327
328
|
ret += v
|
|
328
329
|
return ret
|
|
329
330
|
|
kafka/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '2.3.
|
|
1
|
+
__version__ = '2.3.1'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kafka-python
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.1
|
|
4
4
|
Summary: Pure Python client for Apache Kafka
|
|
5
5
|
Author-email: Dana Powers <dana.powers@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/dpkp/kafka-python
|
|
@@ -66,22 +66,11 @@ Python client for the Apache Kafka distributed stream processing system.
|
|
|
66
66
|
kafka-python is designed to function much like the official java client, with a
|
|
67
67
|
sprinkling of pythonic interfaces (e.g., consumer iterators).
|
|
68
68
|
|
|
69
|
-
kafka-python is best used with newer brokers (0.9+), but is backwards-compatible with
|
|
70
|
-
older versions (to 0.8.0). Some features will only be enabled on newer brokers.
|
|
71
|
-
For example, fully coordinated consumer groups -- i.e., dynamic partition
|
|
72
|
-
assignment to multiple consumers in the same group -- requires use of 0.9+ kafka
|
|
73
|
-
brokers. Supporting this feature for earlier broker releases would require
|
|
74
|
-
writing and maintaining custom leadership election and membership / health
|
|
75
|
-
check code (perhaps using zookeeper or consul). For older brokers, you can
|
|
76
|
-
achieve something similar by manually assigning different partitions to each
|
|
77
|
-
consumer instance with config management tools like chef, ansible, etc. This
|
|
78
|
-
approach will work fine, though it does not support rebalancing on failures.
|
|
79
|
-
See https://kafka-python.readthedocs.io/en/master/compatibility.html
|
|
80
|
-
for more details.
|
|
81
|
-
|
|
82
69
|
Please note that the master branch may contain unreleased features. For release
|
|
83
70
|
documentation, please see readthedocs and/or python's inline help.
|
|
84
71
|
|
|
72
|
+
New in 2.3 release: python -m kafka.* interfaces for quick scripts and testing.
|
|
73
|
+
|
|
85
74
|
.. code-block:: bash
|
|
86
75
|
|
|
87
76
|
$ pip install kafka-python
|
|
@@ -232,6 +221,14 @@ for more details.
|
|
|
232
221
|
metrics = producer.metrics()
|
|
233
222
|
|
|
234
223
|
|
|
224
|
+
Module CLI Interface
|
|
225
|
+
********************
|
|
226
|
+
|
|
227
|
+
kafka-python also provides simple command-line interfaces for consumer, producer, and admin clients.
|
|
228
|
+
Access via ``python -m kafka.consumer``, ``python -m kafka.producer``, and ``python -m kafka.admin``.
|
|
229
|
+
See https://kafka-python.readthedocs.io/en/master/usage.html for more details.
|
|
230
|
+
|
|
231
|
+
|
|
235
232
|
Thread safety
|
|
236
233
|
*************
|
|
237
234
|
|
|
@@ -2,14 +2,14 @@ kafka/__init__.py,sha256=4dvHKZAxmD_4tfJ5wGcRV2X78vPcm8vsUoqceULevjA,1077
|
|
|
2
2
|
kafka/__main__.py,sha256=HNnJxekZZkNDXQwqnE5AfaM56JNCNYvq135wu4jxvhk,107
|
|
3
3
|
kafka/client_async.py,sha256=NFjHZu-aa4tUKOz-l9d9-dkN8dKt9OEJ-4ljxNgbw-M,57031
|
|
4
4
|
kafka/cluster.py,sha256=kTWqLHD-CZY_ua2LftVSvEjmNAL7KJ98Rd17zA177FU,16915
|
|
5
|
-
kafka/codec.py,sha256=
|
|
5
|
+
kafka/codec.py,sha256=_jglwQ8yn-B85hzf0nvOvazRwGQSBx22Bb8R4sSCvcs,9977
|
|
6
6
|
kafka/conn.py,sha256=hDwKQ93zpZAWfACdiInEfcBSD6MpYCxVNoAjFneQW9Q,70406
|
|
7
7
|
kafka/errors.py,sha256=6DbK-_ov_TROE_q8PlaxuTPh9LVnguwEIBcNBiakW6k,33451
|
|
8
8
|
kafka/future.py,sha256=ZQStbfUYIPJRrgMfAWxxjrIRVxsw4WCtSR0J0bkyGno,2847
|
|
9
9
|
kafka/socks5_wrapper.py,sha256=h0Gag3xAOp8io2MfzeYLOiNvLRmq3rkmpZ6Aj-9uKTw,10716
|
|
10
10
|
kafka/structs.py,sha256=SJGzmLdV21jZyQ7247k0WFy16UiusgTHK3I-e4qzI-E,3058
|
|
11
11
|
kafka/util.py,sha256=ncFqg0mXda_ipyLoAw_EF4dX8-lYanC2QtzC-l_F7-w,4585
|
|
12
|
-
kafka/version.py,sha256=
|
|
12
|
+
kafka/version.py,sha256=0Ns5BhVD3XOEWhtSUJ76K319NapPiQfZKsWZRt-kZOk,22
|
|
13
13
|
kafka/admin/__init__.py,sha256=S_XxqyyV480_yXhttK79XZqNAmZyXRjspd3SoqYykE8,720
|
|
14
14
|
kafka/admin/__main__.py,sha256=mQrmllHNZx4SnFWd5WHJdQqfsqunFR1pnkIVppm3MqU,109
|
|
15
15
|
kafka/admin/acl_resource.py,sha256=UVfKDMsxRl-yGeCrbn0OX74aDbBQTibLgWMfCxkle5I,8480
|
|
@@ -46,12 +46,12 @@ kafka/cli/consumer/__init__.py,sha256=Kw4v9vSLBXD2KxSSMrloAuauWi7Zke2C2M8PCvcGJ4
|
|
|
46
46
|
kafka/cli/producer/__init__.py,sha256=Wy_8p1TSzDkd9YnFvgG91AFXN6j8toVVfrNA0r_kplY,2633
|
|
47
47
|
kafka/consumer/__init__.py,sha256=NDdvtyuJgFyQZahqL9i5sYXGP6rOMIXWwHQEaZ1fCcs,122
|
|
48
48
|
kafka/consumer/__main__.py,sha256=JcySmP6wWi5NxK4icqMWPbFkf2722X4J-gQvbQZtDsk,112
|
|
49
|
-
kafka/consumer/fetcher.py,sha256=
|
|
49
|
+
kafka/consumer/fetcher.py,sha256=TR6LJ2pa0LfJ5kTC-6DPHkMPO2CAo8qV-iO79VQ5F10,69375
|
|
50
50
|
kafka/consumer/group.py,sha256=iMKfNEjCzL6UGbwA7MWBU_o1gaLRCIxFSj-JmCMF3RM,60637
|
|
51
51
|
kafka/consumer/subscription_state.py,sha256=bK-YTVbOzhy8OB206QAfXVuo7zPA9YqYXnrRRST369c,24289
|
|
52
52
|
kafka/coordinator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
53
53
|
kafka/coordinator/base.py,sha256=QP0YwJVj244BPwx9vP5XlI-E6geniztsJstiyglZI2k,58502
|
|
54
|
-
kafka/coordinator/consumer.py,sha256=
|
|
54
|
+
kafka/coordinator/consumer.py,sha256=ZHiiCKRsglPwhgQ5u7QPeFmwKDCRaJbA05ioZJITzWI,48574
|
|
55
55
|
kafka/coordinator/heartbeat.py,sha256=LeJJlwz1oUEOfEMIFT-R7ZOHBQ-b-luVKwmKyWxLfDo,3242
|
|
56
56
|
kafka/coordinator/protocol.py,sha256=Jq5OvRGGSrVCymufXsD-ZfUK-3ntsuFZE3Zu7lIaPkg,1041
|
|
57
57
|
kafka/coordinator/subscription.py,sha256=Rzdl2WnZdFB6v9M1cpZiWB_yzmVUJzB2X15KttMdBmw,922
|
|
@@ -122,7 +122,7 @@ kafka/protocol/sasl_authenticate.py,sha256=HaFAHPRhCKgyGEoJ5LwGffcpMUBNCphgBgXCs
|
|
|
122
122
|
kafka/protocol/sasl_handshake.py,sha256=WzQh9HBRemXvShrczkN4rd4SM-hNdes1khMzPRvcRQQ,982
|
|
123
123
|
kafka/protocol/struct.py,sha256=iHVlM7QySnVDBbN_v4mRFmU6LJ6kslvITRdaYIsus-Q,2377
|
|
124
124
|
kafka/protocol/txn_offset_commit.py,sha256=_6Wr-SabUd9q09Tj9oG43AVZcqlW3LYbqXNW1Pvk9vs,2250
|
|
125
|
-
kafka/protocol/types.py,sha256=
|
|
125
|
+
kafka/protocol/types.py,sha256=SXAlAfrHi5q5siMxYxiMcWN_eX0fjcQs7ZRphpuUT-A,11237
|
|
126
126
|
kafka/record/__init__.py,sha256=Q20hP_R5XX3AEnAlPkpoWzTLShESvxUT2OLXmI-JYEQ,129
|
|
127
127
|
kafka/record/_crc32c.py,sha256=Ok-P62Yvg6D6rMGM9Z56OMjZWQlnps4xBbakg-sdxvI,5761
|
|
128
128
|
kafka/record/abc.py,sha256=z1UYURHbD2RyyGRpVXKP598jck5eXU9p4M6iUo6ZSFo,4110
|
|
@@ -145,7 +145,7 @@ kafka/vendor/enum34.py,sha256=-u-lxAiJMt6ru4Do7NUDY9OpeWkYJMksb2xengJawFE,31204
|
|
|
145
145
|
kafka/vendor/selectors34.py,sha256=gxejLO4eXf8mRSGXaQiknPig3GdX1rtsZiYOQJVuAy8,20594
|
|
146
146
|
kafka/vendor/six.py,sha256=lLBa9_HrANP5BMZ7twEzg1M3wofwPmXyptuWmHX0brY,34826
|
|
147
147
|
kafka/vendor/socketpair.py,sha256=Fi3PoY1Okkppab720wFk1BhHXyjcw7hi5DwhqrYZH2Y,2737
|
|
148
|
-
kafka_python-2.3.
|
|
149
|
-
kafka_python-2.3.
|
|
150
|
-
kafka_python-2.3.
|
|
151
|
-
kafka_python-2.3.
|
|
148
|
+
kafka_python-2.3.1.dist-info/METADATA,sha256=9CuWXkHGkkSqO8pfMQSle7IvLXZ250msWSY2d7EqIik,9494
|
|
149
|
+
kafka_python-2.3.1.dist-info/WHEEL,sha256=TdQ5LtNwLuxTCjgxN51AgdU5w-KkB9ttmLbzjTH02pg,109
|
|
150
|
+
kafka_python-2.3.1.dist-info/top_level.txt,sha256=IivJz7l5WHdLNDT6RIiVAlhjQzYRwGqBBmKHZ7WjPeM,6
|
|
151
|
+
kafka_python-2.3.1.dist-info/RECORD,,
|
|
File without changes
|