summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/albumentations/default.nix
blob: 0cf23c5bf18eb8545d06eb245ac25e67d38ef127 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  setuptools,

  # dependencies
  albucore,
  numpy,
  opencv-python,
  pydantic,
  pyyaml,
  scipy,

  # optional dependencies
  huggingface-hub,
  pillow,
  torch,

  # tests
  deepdiff,
  pytestCheckHook,
  pytest-mock,
  scikit-image,
  scikit-learn,
  torchvision,
}:

buildPythonPackage rec {
  pname = "albumentations";
  version = "2.0.8";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "albumentations-team";
    repo = "albumentations";
    tag = version;
    hash = "sha256-8vUipdkIelRtKwMw63oUBDN/GUI0gegMGQaqDyXAOTQ=";
  };

  patches = [
    ./dont-check-for-updates.patch
  ];

  pythonRelaxDeps = [ "opencv-python" ];

  build-system = [ setuptools ];

  dependencies = [
    albucore
    numpy
    opencv-python
    pydantic
    pyyaml
    scipy
  ];

  optional-dependencies = {
    hub = [ huggingface-hub ];
    pytorch = [ torch ];
    text = [ pillow ];
  };

  nativeCheckInputs = [
    deepdiff
    pytestCheckHook
    pytest-mock
    scikit-image
    scikit-learn
    torch
    torchvision
  ];

  disabledTests = [
    "test_pca_inverse_transform"
    # these tests hang
    "test_keypoint_remap_methods"
    "test_multiprocessing_support"
  ];

  pythonImportsCheck = [ "albumentations" ];

  meta = {
    description = "Fast image augmentation library and easy to use wrapper around other libraries";
    homepage = "https://github.com/albumentations-team/albumentations";
    changelog = "https://github.com/albumentations-team/albumentations/releases/tag/${src.tag}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ natsukium ];
  };
}