From 58cb4eefc3fb60b235bd3ba1d7c7dc2c73ee53d0 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Mon, 9 Jun 2025 23:27:29 +0200 Subject: [PATCH] python3Packages.mir-eval: fix build, enable tests, refactor & clean --- .../python-modules/mir-eval/default.nix | 44 ++++++++++++++----- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/pkgs/development/python-modules/mir-eval/default.nix b/pkgs/development/python-modules/mir-eval/default.nix index 603fba5879bf..1102adfb43d2 100644 --- a/pkgs/development/python-modules/mir-eval/default.nix +++ b/pkgs/development/python-modules/mir-eval/default.nix @@ -1,33 +1,53 @@ { lib, buildPythonPackage, - fetchPypi, - future, - six, + fetchFromGitHub, + setuptools, + decorator, numpy, scipy, matplotlib, + pytestCheckHook, + pytest-cov-stub, + pytest-mpl, }: buildPythonPackage rec { pname = "mir-eval"; version = "0.8.2"; - format = "setuptools"; + pyproject = true; - src = fetchPypi { - pname = "mir_eval"; - inherit version; - hash = "sha256-FBo+EZMnaIn8MukRVH5z3LPoKe6M/qYPe7zWM8B5JWk="; + src = fetchFromGitHub { + owner = "mir-evaluation"; + repo = "mir_eval"; + tag = version; + hash = "sha256-Dq/kqoTY8YGATsr6MSgfQxkWvFpmH/Pf1pKBLPApylY="; }; - propagatedBuildInputs = [ - future - six + build-system = [ setuptools ]; + + dependencies = [ + decorator numpy scipy - matplotlib ]; + optional-dependencies.display = [ matplotlib ]; + + nativeCheckInputs = [ + pytestCheckHook + pytest-cov-stub + pytest-mpl + ] ++ lib.flatten (lib.attrValues optional-dependencies); + + preCheck = '' + pushd tests + ''; + + postCheck = '' + popd + ''; + pythonImportsCheck = [ "mir_eval" ]; meta = with lib; {