From 0035f2851be3c4ed889c1af73a92f9a09d276ede Mon Sep 17 00:00:00 2001 From: Lyn Nagara Date: Mon, 23 Jan 2023 13:12:12 -0800 Subject: [PATCH] build: Split avro, json, msgpack into separate modules (#176) So it is possible to import use each of the codecs independently without including all of the optional dependencies. --- arroyo/processing/strategies/decoder/__init__.py | 10 ++++------ tests/processing/strategies/test_decoder.py | 6 +++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/arroyo/processing/strategies/decoder/__init__.py b/arroyo/processing/strategies/decoder/__init__.py index 431a1af0..aa04714b 100644 --- a/arroyo/processing/strategies/decoder/__init__.py +++ b/arroyo/processing/strategies/decoder/__init__.py @@ -1,19 +1,17 @@ -from arroyo.processing.strategies.decoder.avro import AvroCodec +from arroyo.processing.strategies.decoder import avro, json, msgpack from arroyo.processing.strategies.decoder.base import ( Codec, DecodedKafkaMessage, KafkaMessageDecoder, ValidationError, ) -from arroyo.processing.strategies.decoder.json import JsonCodec -from arroyo.processing.strategies.decoder.msgpack import MsgpackCodec __all__ = [ - "AvroCodec", + "avro", + "json", + "msgpack", "Codec", "DecodedKafkaMessage", - "JsonCodec", "KafkaMessageDecoder", - "MsgpackCodec", "ValidationError", ] diff --git a/tests/processing/strategies/test_decoder.py b/tests/processing/strategies/test_decoder.py index e7dacaf8..3219598d 100644 --- a/tests/processing/strategies/test_decoder.py +++ b/tests/processing/strategies/test_decoder.py @@ -11,13 +11,13 @@ from arroyo.backends.kafka import KafkaPayload from arroyo.processing.strategies.decoder import ( - AvroCodec, DecodedKafkaMessage, - JsonCodec, KafkaMessageDecoder, - MsgpackCodec, ValidationError, ) +from arroyo.processing.strategies.decoder.avro import AvroCodec +from arroyo.processing.strategies.decoder.json import JsonCodec +from arroyo.processing.strategies.decoder.msgpack import MsgpackCodec from arroyo.types import Message, Partition, Topic, Value