Merge pull request #307098 from r-ryantm/auto-update/cilium-cli
[NixPkgs.git] / pkgs / development / python-modules / imagededup / default.nix
blob7b5be6e31709bf6b22dc9856e0ed4d1224f2e2b6
1 { lib
2 , buildPythonPackage
3 , cython
4 , fetchFromGitHub
5 , fetchurl
6 , matplotlib
7 , pillow
8 , pytest-mock
9 , pytestCheckHook
10 , pythonOlder
11 , pywavelets
12 , scikit-learn
13 , setuptools
14 , torch
15 , torchvision
16 , tqdm
18 let
19   MobileNetV3 = fetchurl {
20     url = "https://download.pytorch.org/models/mobilenet_v3_small-047dcff4.pth";
21     hash = "sha256-BH3P9K3e+G6lvC7/E8lhTcEfR6sRYNCnGiXn25lPTh8=";
22   };
23   ViT = fetchurl {
24     url = "https://download.pytorch.org/models/vit_b_16_swag-9ac1b537.pth";
25     hash = "sha256-msG1N42ZJ71sg3TODNVX74Dhs/j7wYWd8zLE3J0P2CU=";
26   };
27   EfficientNet = fetchurl {
28     url = "https://download.pytorch.org/models/efficientnet_b4_rwightman-23ab8bcd.pth";
29     hash = "sha256-I6uLzVvb72GnpDuRrcrYH2Iv1/NvtJNaVpgo13iIxE4=";
30   };
32 buildPythonPackage rec {
33   pname = "imagededup";
34   version = "0.3.2";
35   pyproject = true;
37   disabled = pythonOlder "3.8";
39   src = fetchFromGitHub {
40     owner = "idealo";
41     repo = "imagededup";
42     rev = "refs/tags/v${version}";
43     hash = "sha256-B2IuNMTZnzBi6IxrHBoMDsmIcqGQpznd/2f1XKo1Oa4=";
44   };
46   nativeBuildInputs = [
47     cython
48     setuptools
49   ];
51   propagatedBuildInputs = [
52     matplotlib
53     pillow
54     pywavelets
55     scikit-learn
56     torch
57     torchvision
58     tqdm
59   ];
61   nativeCheckInputs = [
62     pytest-mock
63     pytestCheckHook
64   ];
66   preCheck = ''
67     export HOME=$(mktemp -d)
69     # Checks with CNN are preloaded to avoid downloads in the check phase
70     mkdir -p $HOME/.cache/torch/hub/checkpoints/
71     ln -s ${MobileNetV3} $HOME/.cache/torch/hub/checkpoints/${MobileNetV3.name}
72     ln -s ${ViT} $HOME/.cache/torch/hub/checkpoints/${ViT.name}
73     ln -s ${EfficientNet} $HOME/.cache/torch/hub/checkpoints/${EfficientNet.name}
74   '';
76   pythonImportsCheck = [
77     "imagededup"
78   ];
80   meta = with lib; {
81     homepage = "https://idealo.github.io/imagededup/";
82     changelog = "https://github.com/idealo/imagededup/releases/tag/${src.rev}";
83     description = "Finding duplicate images made easy";
84     license = licenses.asl20;
85     maintainers = with maintainers; [ stunkymonkey ];
86   };