1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonAtLeast,
6
7 # build-system
8 cmake,
9 pkg-config,
10 rustPlatform,
11
12 # native dependencies
13 cyrus_sasl,
14 openssl,
15 protobuf,
16
17 # dependencies
18 jsonpickle,
19 prometheus-client,
20
21 # optional dependencies
22 confluent-kafka,
23
24 # test
25 myst-docutils,
26 pytestCheckHook,
27 pytest-benchmark,
28}:
29
30buildPythonPackage rec {
31 pname = "bytewax";
32 version = "0.21.1";
33 pyproject = true;
34
35 # error: the configured Python interpreter version (3.13) is newer than PyO3's maximum supported version (3.12)
36 disabled = pythonAtLeast "3.13";
37
38 src = fetchFromGitHub {
39 owner = "bytewax";
40 repo = "bytewax";
41 tag = "v${version}";
42 hash = "sha256-O5q1Jd3AMUaQwfQM249CUnkjqEkXybxtM9SOISoULZk=";
43 };
44
45 env = {
46 OPENSSL_NO_VENDOR = true;
47 };
48
49 cargoDeps = rustPlatform.fetchCargoVendor {
50 inherit pname version src;
51 hash = "sha256-TTB1//Xza47rnfvlIs9qMvwHPj/U3w2cGTmWrEokriQ=";
52 };
53
54 nativeBuildInputs = [
55 cmake
56 pkg-config
57 rustPlatform.maturinBuildHook
58 rustPlatform.cargoSetupHook
59 ];
60
61 dontUseCmakeConfigure = true;
62
63 buildInputs = [
64 openssl
65 cyrus_sasl
66 protobuf
67 ];
68
69 dependencies = [
70 jsonpickle
71 prometheus-client
72 ];
73
74 optional-dependencies = {
75 kafka = [ confluent-kafka ];
76 };
77
78 preCheck = ''
79 export PY_IGNORE_IMPORTMISMATCH=1
80 '';
81
82 nativeCheckInputs = [
83 myst-docutils
84 pytestCheckHook
85 pytest-benchmark
86 ]
87 ++ lib.flatten (lib.attrValues optional-dependencies);
88
89 pytestFlags = [
90 "--benchmark-disable"
91 ];
92
93 enabledTestPaths = [
94 "pytests"
95 ];
96
97 disabledTestPaths = [
98 # dependens on an old myst-docutils version
99 "docs"
100 ];
101
102 pythonImportsCheck = [ "bytewax" ];
103
104 meta = {
105 description = "Python Stream Processing";
106 homepage = "https://github.com/bytewax/bytewax";
107 changelog = "https://github.com/bytewax/bytewax/releases/tag/v${version}";
108 license = lib.licenses.asl20;
109 maintainers = with lib.maintainers; [
110 mslingsby
111 kfollesdal
112 ];
113 };
114}