nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools,
8
9 # dependencies
10 numpy,
11 scikit-learn,
12 termcolor,
13 tqdm,
14 pandas,
15
16 # tests
17 cleanvision,
18 datasets,
19 fasttext,
20 hypothesis,
21 keras,
22 matplotlib,
23 pytestCheckHook,
24 pytest-lazy-fixture,
25 skorch,
26 tensorflow,
27 torch,
28 torchvision,
29 wget,
30 pythonAtLeast,
31}:
32
33buildPythonPackage (finalAttrs: {
34 pname = "cleanlab";
35 version = "2.9.0";
36 pyproject = true;
37
38 src = fetchFromGitHub {
39 owner = "cleanlab";
40 repo = "cleanlab";
41 tag = "v${finalAttrs.version}";
42 hash = "sha256-0H4JTAc2tCtIFklGciXQ+TCWOiJ6kRkqcycJNeIpero=";
43 };
44
45 postPatch = ''
46 substituteInPlace pyproject.toml \
47 --replace-fail "setuptools>=65.0,<70.0" "setuptools"
48 '';
49
50 build-system = [
51 setuptools
52 ];
53
54 dependencies = [
55 numpy
56 scikit-learn
57 termcolor
58 tqdm
59 pandas
60 ];
61
62 nativeCheckInputs = [
63 cleanvision
64 datasets
65 fasttext
66 hypothesis
67 keras
68 matplotlib
69 pytestCheckHook
70 pytest-lazy-fixture
71 skorch
72 tensorflow
73 torch
74 torchvision
75 wget
76 ];
77
78 disabledTests = [
79 # Incorrect snapshots (AssertionError)
80 "test_color_sentence"
81
82 # Requires the datasets we prevent from downloading
83 "test_create_imagelab"
84
85 # AssertionError: assert np.int64(36) == 35
86 "test_num_label_issues"
87
88 # Non-trivial numpy2 incompatibilities
89 # assert np.float64(0.492) == 0.491
90 "test_duplicate_points_have_similar_scores"
91 # AssertionError: assert 'Annotators [1] did not label any examples.'
92 "test_label_quality_scores_multiannotator"
93 ]
94 ++ lib.optionals (pythonAtLeast "3.12") [
95 # AttributeError: 'called_once_with' is not a valid assertion.
96 # Use a spec for the mock if 'called_once_with' is meant to be an attribute..
97 # Did you mean: 'assert_called_once_with'?
98 "test_custom_issue_manager_not_registered"
99 ];
100
101 disabledTestPaths = [
102 # Requires internet
103 "tests/test_dataset.py"
104 # Requires the datasets we just prevented from downloading
105 "tests/datalab/test_cleanvision_integration.py"
106 # Fails because of issues with the keras derivation
107 "tests/test_frameworks.py"
108 ];
109
110 meta = {
111 description = "Standard data-centric AI package for data quality and machine learning with messy, real-world data and labels";
112 homepage = "https://github.com/cleanlab/cleanlab";
113 changelog = "https://github.com/cleanlab/cleanlab/releases/tag/${finalAttrs.src.tag}";
114 license = lib.licenses.agpl3Only;
115 maintainers = with lib.maintainers; [ happysalada ];
116 };
117})