1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 pythonOlder, 6 setuptools, 7 setuptools-scm, 8 joblib, 9 keras, 10 numpy, 11 pandas, 12 scikit-learn, 13 scipy, 14 tensorflow, 15 threadpoolctl, 16 pytestCheckHook, 17 python, 18}: 19 20buildPythonPackage rec { 21 pname = "imbalanced-learn"; 22 version = "0.14.0"; 23 pyproject = true; 24 25 disabled = pythonOlder "3.8"; 26 27 src = fetchFromGitHub { 28 owner = "scikit-learn-contrib"; 29 repo = "imbalanced-learn"; 30 tag = version; 31 hash = "sha256-1R7jHOkTO3zK9bkUvvOPQ420ofqIO7J1rqixFEbApR0="; 32 }; 33 34 build-system = [ 35 setuptools 36 setuptools-scm 37 ]; 38 39 dependencies = [ 40 joblib 41 numpy 42 scikit-learn 43 scipy 44 threadpoolctl 45 ]; 46 47 optional-dependencies = { 48 optional = [ 49 keras 50 pandas 51 tensorflow 52 ]; 53 }; 54 55 pythonImportsCheck = [ "imblearn" ]; 56 57 nativeCheckInputs = [ 58 pytestCheckHook 59 pandas 60 ]; 61 62 preCheck = '' 63 export HOME=$TMPDIR 64 # The GitHub source contains too many files picked up by pytest like 65 # examples and documentation files which can't pass. 66 cd $out/${python.sitePackages} 67 ''; 68 69 disabledTestPaths = [ 70 # require tensorflow and keras, but we don't want to 71 # add them to nativeCheckInputs just for this tests 72 "imblearn/keras" 73 "imblearn/tensorflow" 74 # even with precheck directory change, pytest still tries to test docstrings 75 "imblearn/tests/test_docstring_parameters.py" 76 # Skip dependencies test - pythonImportsCheck already does this 77 "imblearn/utils/tests/test_min_dependencies.py" 78 ]; 79 80 disabledTests = [ 81 # Broken upstream test https://github.com/scikit-learn-contrib/imbalanced-learn/issues/1131 82 "test_estimators_compatibility_sklearn" 83 "test_balanced_bagging_classifier_with_function_sampler" 84 ]; 85 86 meta = { 87 description = "Library offering a number of re-sampling techniques commonly used in datasets showing strong between-class imbalance"; 88 homepage = "https://github.com/scikit-learn-contrib/imbalanced-learn"; 89 changelog = "https://github.com/scikit-learn-contrib/imbalanced-learn/releases/tag/${version}"; 90 license = lib.licenses.mit; 91 maintainers = with lib.maintainers; [ 92 rmcgibbo 93 philipwilk 94 ]; 95 }; 96}