summaryrefslogtreecommitdiffstats
path: root/pkgs/development/python-modules/bytewax/default.nix
blob: d4b48bf479abf4588cf0efb5e95b0196e5fed392 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pythonAtLeast,

  # build-system
  cmake,
  pkg-config,
  rustPlatform,

  # native dependencies
  cyrus_sasl,
  openssl,
  protobuf,

  # dependencies
  jsonpickle,
  prometheus-client,

  # optional dependencies
  confluent-kafka,

  # test
  myst-parser,
  pytestCheckHook,
  pytest-benchmark,
}:

buildPythonPackage rec {
  pname = "bytewax";
  version = "0.21.1";
  pyproject = true;

  # error: the configured Python interpreter version (3.13) is newer than PyO3's maximum supported version (3.12)
  disabled = pythonAtLeast "3.13";

  src = fetchFromGitHub {
    owner = "bytewax";
    repo = "bytewax";
    tag = "v${version}";
    hash = "sha256-O5q1Jd3AMUaQwfQM249CUnkjqEkXybxtM9SOISoULZk=";
  };

  env = {
    OPENSSL_NO_VENDOR = true;
  };

  cargoDeps = rustPlatform.fetchCargoVendor {
    inherit pname version src;
    hash = "sha256-TTB1//Xza47rnfvlIs9qMvwHPj/U3w2cGTmWrEokriQ=";
  };

  nativeBuildInputs = [
    cmake
    pkg-config
    rustPlatform.maturinBuildHook
    rustPlatform.cargoSetupHook
  ];

  dontUseCmakeConfigure = true;

  buildInputs = [
    openssl
    cyrus_sasl
    protobuf
  ];

  dependencies = [
    jsonpickle
    prometheus-client
  ];

  optional-dependencies = {
    kafka = [ confluent-kafka ];
  };

  preCheck = ''
    export PY_IGNORE_IMPORTMISMATCH=1
  '';

  nativeCheckInputs = [
    myst-parser
    pytestCheckHook
    pytest-benchmark
  ]
  ++ lib.concatAttrValues optional-dependencies;

  pytestFlags = [
    "--benchmark-disable"
  ];

  enabledTestPaths = [
    "pytests"
  ];

  disabledTestPaths = [
    # depends on an old myst-parser version
    "docs"
  ];

  pythonImportsCheck = [ "bytewax" ];

  meta = {
    description = "Python Stream Processing";
    homepage = "https://github.com/bytewax/bytewax";
    changelog = "https://github.com/bytewax/bytewax/releases/tag/v${version}";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [
      mslingsby
      kfollesdal
    ];
  };
}