1{ lib
2, buildPythonPackage
3, pythonOlder
4, fetchFromGitHub
5, numpy
6}:
7let
8 pname = "rank_bm25";
9 version = "0.2.2";
10in
11buildPythonPackage {
12 inherit version pname;
13 format = "setuptools";
14
15 # Pypi source package doesn't contain tests
16 src = fetchFromGitHub {
17 owner = "dorianbrown";
18 repo = pname;
19 rev = version;
20 hash = "sha256-+BxQBflMm2AvCLAFFj52Jpkqn+KErwYXU1wztintgOg=";
21 };
22
23 disabled = pythonOlder "3.7";
24
25 postPatch = ''
26 # Upstream doesn't provide a PKG-INFO file
27 substituteInPlace setup.py --replace "get_version()" "'${version}'"
28 '';
29
30 propagatedBuildInputs = [
31 numpy
32 ];
33
34 pythonImportsCheck = [ "rank_bm25" ];
35
36 meta = with lib; {
37 description = "A Collection of BM25 Algorithms in Python";
38 homepage = "https://github.com/dorianbrown/rank_bm25";
39 changelog = "https://github.com/dorianbrown/rank_bm25/releases/tag/${version}";
40 license = licenses.asl20;
41 maintainers = with maintainers; [ happysalada ];
42 };
43}