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