1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # Propagated build inputs
7 portalocker,
8 regex,
9 tabulate,
10 numpy,
11 colorama,
12 lxml,
13
14 # Check inputs
15 pytestCheckHook,
16}:
17let
18 pname = "sacrebleu";
19 version = "2.4.2";
20in
21buildPythonPackage {
22 inherit pname version;
23 format = "setuptools";
24
25 src = fetchFromGitHub {
26 owner = "mjpost";
27 repo = pname;
28 rev = "refs/tags/v${version}";
29 hash = "sha256-evSBHvDFOJlE2f9uM+NNCQeABY5lCc3Rs9dq11n7v5c=";
30 };
31
32 # postPatch = ''
33 # substituteInPlace setup.py \
34 # --replace "portalocker==" "portalocker>="
35 # '';
36
37 propagatedBuildInputs = [
38 portalocker
39 regex
40 tabulate
41 numpy
42 colorama
43 lxml
44 ];
45
46 checkInputs = [ pytestCheckHook ];
47
48 disabledTestPaths = [
49 # require network access
50 "test/test_api.py"
51 "test/test_dataset.py"
52 ];
53
54 preCheck = ''
55 export HOME=$(mktemp -d)
56 '';
57
58 pythonImportsCheck = [ "sacrebleu" ];
59
60 meta = with lib; {
61 description = "Hassle-free computation of shareable, comparable, and reproducible BLEU, chrF, and TER scores";
62 mainProgram = "sacrebleu";
63 homepage = "https://github.com/mjpost/sacrebleu";
64 changelog = "https://github.com/mjpost/sacrebleu/blob/v{version}/CHANGELOG.md";
65 license = licenses.asl20;
66 maintainers = with maintainers; [ happysalada ];
67 };
68}