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