1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6
7 # build-system
8 setuptools,
9
10 # dependencies
11 albucore,
12 eval-type-backport,
13 numpy,
14 opencv-python,
15 pydantic,
16 pyyaml,
17 scikit-image,
18 scipy,
19
20 # optional dependencies
21 huggingface-hub,
22 pillow,
23
24 # tests
25 deepdiff,
26 pytestCheckHook,
27 pytest-mock,
28 torch,
29 torchvision,
30}:
31
32buildPythonPackage rec {
33 pname = "albumentations";
34 version = "1.4.23";
35 pyproject = true;
36
37 disabled = pythonOlder "3.9";
38
39 src = fetchFromGitHub {
40 owner = "albumentations-team";
41 repo = "albumentations";
42 tag = version;
43 hash = "sha256-d/5ZTSFcQqsiF2rDX92iXO2eHHS+GOBvWFw0MlSwyhE=";
44 };
45
46 patches = [
47 ./dont-check-for-updates.patch
48 ];
49
50 pythonRelaxDeps = [ "opencv-python" ];
51
52 build-system = [ setuptools ];
53
54 dependencies = [
55 albucore
56 eval-type-backport
57 numpy
58 opencv-python
59 pydantic
60 pyyaml
61 scikit-image
62 scipy
63 ];
64
65 optional-dependencies = {
66 hub = [ huggingface-hub ];
67 text = [ pillow ];
68 };
69
70 nativeCheckInputs = [
71 deepdiff
72 pytestCheckHook
73 pytest-mock
74 torch
75 torchvision
76 ];
77
78 disabledTests = [
79 "test_pca_inverse_transform"
80 # this test hangs up
81 "test_transforms"
82 ];
83
84 pythonImportsCheck = [ "albumentations" ];
85
86 meta = {
87 description = "Fast image augmentation library and easy to use wrapper around other libraries";
88 homepage = "https://github.com/albumentations-team/albumentations";
89 changelog = "https://github.com/albumentations-team/albumentations/releases/tag/${version}";
90 license = lib.licenses.mit;
91 maintainers = with lib.maintainers; [ natsukium ];
92 };
93}