summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/datasketch/default.nix
blob: 3fa258565dbe7014e8096bd6746f921276013c8b (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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  # build
  hatchling,
  # runtime
  cassandra-driver,
  motor,
  numpy,
  pybloomfilter3,
  redis,
  scipy,
  # check
  pytestCheckHook,
  aiounittest,
  mock,
  pymongo,
  pytest-asyncio,
  pytest-rerunfailures,

}:

buildPythonPackage (finalAttrs: {
  pname = "datasketch";
  version = "1.10.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "ekzhu";
    repo = "datasketch";
    tag = "v${finalAttrs.version}";
    hash = "sha256-PSSu+ymAFWSsNRaAByGuUjoDSqzkiC0mwHpuD5YVFjA=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail "--cov-report=xml" ""
  '';

  build-system = [ hatchling ];

  dependencies = [
    numpy
    scipy
  ];

  optional-dependencies = rec {
    cassandra = [ cassandra-driver ];
    redis = [ redis ];
    experimental_aio = [
      motor
      aiounittest
    ];
    bloom = [ pybloomfilter3 ];
    all = cassandra ++ redis ++ experimental_aio ++ bloom;
  };

  nativeCheckInputs = [
    pytestCheckHook
    cassandra-driver
    mock
    motor
    redis
    pybloomfilter3
    pymongo
    pytest-rerunfailures
    pytest-asyncio
  ];

  disabledTestPaths = [
    # these tests import mockredis, which has been abandoned for many years
    "test/test_lsh.py"
    "test/test_lshensemble.py"
  ];
  disabledTests = [
    # flaky
    "test_soft_remove_and_pop_and_clean"
  ];

  meta = {
    changelog = "https://github.com/ekzhu/datasketch/releases/tag/v${finalAttrs.version}";
    description = "MinHash, LSH, LSH Forest, Weighted MinHash, HyperLogLog, HyperLogLog++, LSH Ensemble and HNSW";
    homepage = "https://ekzhu.com/datasketch/";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ jokatzke ];
  };
})