1{ 2 lib, 3 buildPythonPackage, 4 pythonOlder, 5 fetchFromGitHub, 6 7 # build-system 8 setuptools, 9 10 # dependencies 11 albucore, 12 numpy, 13 opencv-python, 14 pydantic, 15 pyyaml, 16 scipy, 17 18 # optional dependencies 19 huggingface-hub, 20 pillow, 21 torch, 22 23 # tests 24 deepdiff, 25 pytestCheckHook, 26 pytest-mock, 27 scikit-image, 28 scikit-learn, 29 torchvision, 30}: 31 32buildPythonPackage rec { 33 pname = "albumentations"; 34 version = "2.0.8"; 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-8vUipdkIelRtKwMw63oUBDN/GUI0gegMGQaqDyXAOTQ="; 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 numpy 57 opencv-python 58 pydantic 59 pyyaml 60 scipy 61 ]; 62 63 optional-dependencies = { 64 hub = [ huggingface-hub ]; 65 pytorch = [ torch ]; 66 text = [ pillow ]; 67 }; 68 69 nativeCheckInputs = [ 70 deepdiff 71 pytestCheckHook 72 pytest-mock 73 scikit-image 74 scikit-learn 75 torch 76 torchvision 77 ]; 78 79 disabledTests = [ 80 "test_pca_inverse_transform" 81 # these tests hang 82 "test_keypoint_remap_methods" 83 "test_multiprocessing_support" 84 ]; 85 86 pythonImportsCheck = [ "albumentations" ]; 87 88 meta = { 89 description = "Fast image augmentation library and easy to use wrapper around other libraries"; 90 homepage = "https://github.com/albumentations-team/albumentations"; 91 changelog = "https://github.com/albumentations-team/albumentations/releases/tag/${src.tag}"; 92 license = lib.licenses.mit; 93 maintainers = with lib.maintainers; [ natsukium ]; 94 }; 95}