From a6649da90a22e31eeef1a39caf2982bcd2b33426 Mon Sep 17 00:00:00 2001 From: happysalada Date: Thu, 6 Jul 2023 13:02:05 +0800 Subject: [PATCH] python310Packages.sacrebleu: init at 2.3.1 --- .../python-modules/sacrebleu/default.nix | 68 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 70 insertions(+) create mode 100644 pkgs/development/python-modules/sacrebleu/default.nix diff --git a/pkgs/development/python-modules/sacrebleu/default.nix b/pkgs/development/python-modules/sacrebleu/default.nix new file mode 100644 index 000000000000..411426eaa34d --- /dev/null +++ b/pkgs/development/python-modules/sacrebleu/default.nix @@ -0,0 +1,68 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub + +# Propagated build inputs +, portalocker +, regex +, tabulate +, numpy +, colorama +, lxml + +# Check inputs +, pytestCheckHook +}: +let + pname = "sacrebleu"; + version = "2.3.1"; +in +buildPythonPackage { + inherit pname version; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "mjpost"; + repo = pname; + rev = "v${version}"; + hash = "sha256-+58dhQv5LkjccjktfoAG2gqja6TMLIxHIbRgzZPDhKo="; + }; + + # postPatch = '' + # substituteInPlace setup.py \ + # --replace "portalocker==" "portalocker>=" + # ''; + + propagatedBuildInputs = [ + portalocker + regex + tabulate + numpy + colorama + lxml + ]; + + checkInputs = [ + pytestCheckHook + ]; + + disabledTestPaths = [ + # require network access + "test/test_api.py" + "test/test_dataset.py" + ]; + + preCheck = '' + export HOME=$(mktemp -d) + ''; + + pythonImportsCheck = [ "sacrebleu" ]; + + meta = with lib; { + description = "Hassle-free computation of shareable, comparable, and reproducible BLEU, chrF, and TER scores"; + homepage = "https://github.com/mjpost/sacrebleu"; + changelog = "https://github.com/mjpost/sacrebleu/blob/v{version}/CHANGELOG.md"; + license = licenses.asl20; + maintainers = with maintainers; [ happysalada ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 84ede43c7a10..919ef010c48f 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -11037,6 +11037,8 @@ self: super: with self; { sacn = callPackage ../development/python-modules/sacn { }; + sacrebleu = callPackage ../development/python-modules/sacrebleu { }; + sacremoses = callPackage ../development/python-modules/sacremoses { }; safe = callPackage ../development/python-modules/safe { };