summary refs log tree commit diff
path: root/pkgs/development/python-modules/rank-bm25/default.nix
blob: 9b0c5080449d139653f9c03b88acaed56063fe5f (plain) (blame)
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
{ lib
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, numpy
}:
let
  pname = "rank-bm25";
  version = "0.2.2";
in
buildPythonPackage {
  inherit version pname;
  format = "setuptools";

  # Pypi source package doesn't contain tests
  src = fetchFromGitHub {
    owner = "dorianbrown";
    repo = pname;
    rev = version;
    hash = "sha256-+BxQBflMm2AvCLAFFj52Jpkqn+KErwYXU1wztintgOg=";
  };

  disabled = pythonOlder "3.7";

  postPatch = ''
    # Upstream doesn't provide a PKG-INFO file
    substituteInPlace setup.py --replace "get_version()" "'${version}'"
  '';

  propagatedBuildInputs = [
    numpy
  ];

  pythonImportsCheck = [ "rank_bm25" ];

  meta = with lib; {
    description = "A Collection of BM25 Algorithms in Python";
    homepage = "https://github.com/dorianbrown/rank_bm25";
    changelog = "https://github.com/dorianbrown/rank_bm25/releases/tag/${version}";
    license = licenses.asl20;
    maintainers = with maintainers; [ happysalada ];
  };
}