From 1cf39c1c73baeef055f32f7178342c692d668ebc Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Thu, 25 Jan 2024 03:15:24 +0000 Subject: [PATCH 1/2] python311Packages.imbalanced-learn: 0.11.0 -> 0.12.0 --- pkgs/development/python-modules/imbalanced-learn/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/imbalanced-learn/default.nix b/pkgs/development/python-modules/imbalanced-learn/default.nix index 1ef8fea6a100..99c4bd0bb88a 100644 --- a/pkgs/development/python-modules/imbalanced-learn/default.nix +++ b/pkgs/development/python-modules/imbalanced-learn/default.nix @@ -9,13 +9,13 @@ buildPythonPackage rec { pname = "imbalanced-learn"; - version = "0.11.0"; + version = "0.12.0"; format = "setuptools"; disabled = isPy27; # scikit-learn>=0.21 doesn't work on python2 src = fetchPypi { inherit pname version; - hash = "sha256-dYKuiFjm2wuS/vl90IZgoYKX7hKNeMKr3ABri9hrj9w="; + hash = "sha256-uczZqqMChpkHnUOm1Nn8nQOfVTdnM7Mfh8fZsSXcwWU="; }; propagatedBuildInputs = [ scikit-learn ]; From e7e92742e5b31189d35fab99b43ab604b48e8afb Mon Sep 17 00:00:00 2001 From: natsukium Date: Thu, 25 Jan 2024 14:00:51 +0900 Subject: [PATCH 2/2] python311Packages.imbalanced-learn: refactor --- .../imbalanced-learn/default.nix | 57 ++++++++++++++----- 1 file changed, 43 insertions(+), 14 deletions(-) diff --git a/pkgs/development/python-modules/imbalanced-learn/default.nix b/pkgs/development/python-modules/imbalanced-learn/default.nix index 99c4bd0bb88a..585e043e4eb3 100644 --- a/pkgs/development/python-modules/imbalanced-learn/default.nix +++ b/pkgs/development/python-modules/imbalanced-learn/default.nix @@ -1,43 +1,72 @@ { lib , buildPythonPackage , fetchPypi -, isPy27 +, pythonOlder +, setuptools +, joblib +, keras +, numpy , pandas -, pytestCheckHook , scikit-learn +, scipy +, tensorflow +, threadpoolctl +, pytest-xdist +, pytestCheckHook }: buildPythonPackage rec { pname = "imbalanced-learn"; version = "0.12.0"; - format = "setuptools"; - disabled = isPy27; # scikit-learn>=0.21 doesn't work on python2 + pyproject = true; + + disabled = pythonOlder "3.8"; src = fetchPypi { inherit pname version; hash = "sha256-uczZqqMChpkHnUOm1Nn8nQOfVTdnM7Mfh8fZsSXcwWU="; }; - propagatedBuildInputs = [ scikit-learn ]; + nativeBuildInputs = [ + setuptools + ]; + + propagatedBuildInputs = [ + joblib + numpy + scikit-learn + scipy + threadpoolctl + ]; + + passthru.optional-dependencies = { + optional = [ + keras + pandas + tensorflow + ]; + }; + + pythonImportsCheck = [ + "imblearn" + ]; + nativeCheckInputs = [ pytestCheckHook pandas ]; + preCheck = '' export HOME=$TMPDIR ''; - disabledTests = [ - "estimator" - "classification" - "_generator" - "show_versions" - "test_make_imbalanced_iris" - "test_rusboost[SAMME.R]" - # https://github.com/scikit-learn-contrib/imbalanced-learn/issues/824 - "ValueDifferenceMetric" + disabledTestPaths = [ + # require tensorflow and keras, but we don't want to + # add them to nativeCheckInputs just for this tests + "imblearn/keras/_generator.py" ]; meta = with lib; { description = "Library offering a number of re-sampling techniques commonly used in datasets showing strong between-class imbalance"; homepage = "https://github.com/scikit-learn-contrib/imbalanced-learn"; + changelog = "https://github.com/scikit-learn-contrib/imbalanced-learn/releases/tag/${version}"; license = licenses.mit; maintainers = [ maintainers.rmcgibbo ]; };