From 6c8a5deaea4dd3ddac146c87b9d4d7a869022f26 Mon Sep 17 00:00:00 2001 From: Madoura Date: Fri, 27 Oct 2023 11:15:19 -0500 Subject: [PATCH] python3Packages.cleanlab: fixup build, tests, use pyproject The packages in nativeCheckInputs lead to some nasty duplicate issues in the enclosure This is worked around by setting catchConflicts to false when doCheck is enabled --- .../python-modules/cleanlab/default.nix | 49 ++++++++++++++----- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/pkgs/development/python-modules/cleanlab/default.nix b/pkgs/development/python-modules/cleanlab/default.nix index f1de682c40b5..fdaf384262b8 100644 --- a/pkgs/development/python-modules/cleanlab/default.nix +++ b/pkgs/development/python-modules/cleanlab/default.nix @@ -6,23 +6,27 @@ , termcolor , tqdm , pandas +, setuptools # test dependencies +, pytestCheckHook +, pytest-lazy-fixture , tensorflow , torch , datasets , torchvision , keras , fasttext +, hypothesis +, wget +, matplotlib +, skorch }: -let + +buildPythonPackage rec { pname = "cleanlab"; version = "2.5.0"; -in -buildPythonPackage { - inherit pname version; - format = "setuptools"; - - disabled = pythonOlder "3.8"; + pyproject = true; + disabled = pythonOlder "3.7"; src = fetchFromGitHub { owner = "cleanlab"; @@ -31,11 +35,7 @@ buildPythonPackage { hash = "sha256-5XQQVrhjpvjwtFM79DqttObmw/GQLkMQVXb5jhiC8e0="; }; - # postPatch = '' - # substituteInPlace pyproject.toml \ - # --replace '"rich <= 13.0.1"' '"rich"' \ - # --replace '"numpy < 1.24.0"' '"numpy"' - # ''; + nativeBuildInputs = [ setuptools ]; propagatedBuildInputs = [ scikit-learn @@ -44,13 +44,38 @@ buildPythonPackage { pandas ]; + # This is ONLY turned off when we have testing enabled. + # The reason we do this is because of duplicate packages in the enclosure + # when using the packages in nativeCheckInputs. + # Affected packages: grpcio protobuf tensorboard tensorboard-plugin-profile + catchConflicts = (!doCheck); + doCheck = true; + nativeCheckInputs = [ + pytestCheckHook + pytest-lazy-fixture tensorflow torch datasets torchvision keras fasttext + hypothesis + wget + matplotlib + skorch + ]; + + disabledTests = [ + # Requires the datasets we prevent from downloading + "test_create_imagelab" + ]; + + disabledTestPaths = [ + # Requires internet + "tests/test_dataset.py" + # Requires the datasets we just prevented from downloading + "tests/datalab/test_cleanvision_integration.py" ]; meta = with lib; {