1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools-scm,
8
9 # Propagated build inputs
10 portalocker,
11 regex,
12 tabulate,
13 numpy,
14 colorama,
15 lxml,
16
17 # Check inputs
18 pytestCheckHook,
19}:
20let
21 pname = "sacrebleu";
22 version = "2.5.1";
23in
24buildPythonPackage {
25 inherit pname version;
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "mjpost";
30 repo = "sacrebleu";
31 tag = "v${version}";
32 hash = "sha256-nLZotWQLrN9hB1fBuDJkvGr4SMvQz8Ucl8ybpNhf9Ic=";
33 };
34
35 build-system = [ setuptools-scm ];
36
37 dependencies = [
38 portalocker
39 regex
40 tabulate
41 numpy
42 colorama
43 lxml
44 ];
45
46 nativeCheckInputs = [ 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 = {
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 = lib.licenses.asl20;
66 maintainers = with lib.maintainers; [ happysalada ];
67 };
68}