1{
2 lib,
3 avro,
4 azure-identity,
5 azure-keyvault-keys,
6 boto3,
7 buildPythonPackage,
8 cacert,
9 cachetools,
10 fastavro,
11 fetchFromGitHub,
12 google-auth,
13 google-api-core,
14 google-cloud-kms,
15 hvac,
16 jsonschema,
17 protobuf,
18 pyflakes,
19 pyrsistent,
20 pytestCheckHook,
21 pythonOlder,
22 pyyaml,
23 rdkafka,
24 requests,
25 requests-mock,
26 respx,
27 setuptools,
28}:
29
30buildPythonPackage rec {
31 pname = "confluent-kafka";
32 version = "2.8.0";
33 pyproject = true;
34
35 disabled = pythonOlder "3.7";
36
37 src = fetchFromGitHub {
38 owner = "confluentinc";
39 repo = "confluent-kafka-python";
40 tag = "v${version}";
41 hash = "sha256-EDEp260G/t7s17RlbT+Bcl7FZlVQFagNijDNw53DFpY=";
42 };
43
44 buildInputs = [ rdkafka ];
45
46 build-system = [ setuptools ];
47
48 optional-dependencies = {
49 avro = [
50 avro
51 fastavro
52 requests
53 ];
54 json = [
55 jsonschema
56 pyrsistent
57 requests
58 ];
59 protobuf = [
60 protobuf
61 requests
62 ];
63 rules = [
64 azure-identity
65 azure-keyvault-keys
66 boto3
67 # TODO: cel-python
68 google-auth
69 google-api-core
70 google-cloud-kms
71 # hkdf was removed
72 hvac
73 # TODO: jsonata-python
74 pyyaml
75 # TODO: tink
76 ];
77 schema-registry = [ requests ];
78 };
79
80 nativeCheckInputs = [
81 cachetools
82 pyflakes
83 pytestCheckHook
84 requests-mock
85 respx
86 ] ++ lib.flatten (lib.attrValues optional-dependencies);
87
88 pythonImportsCheck = [ "confluent_kafka" ];
89
90 disabledTestPaths = [
91 "tests/integration/"
92 "tests/test_Admin.py"
93 "tests/test_misc.py"
94 # missing cel-python dependency
95 "tests/schema_registry/test_avro_serdes.py"
96 "tests/schema_registry/test_json_serdes.py"
97 "tests/schema_registry/test_proto_serdes.py"
98 ];
99
100 meta = with lib; {
101 description = "Confluent's Apache Kafka client for Python";
102 homepage = "https://github.com/confluentinc/confluent-kafka-python";
103 changelog = "https://github.com/confluentinc/confluent-kafka-python/blob/${src.tag}/CHANGELOG.md";
104 license = licenses.asl20;
105 maintainers = with maintainers; [ mlieberman85 ];
106 };
107}