Unverified Commit 6c8a5dea authored by Madoura's avatar Madoura
Browse files

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
parent 8398d16c
Loading
Loading
Loading
Loading
+37 −12
Original line number Diff line number Diff line
@@ -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; {