summary refs log tree commit diff
path: root/pkgs/development/python-modules/easyocr/default.nix
blob: 1199f75c450d0aad4d43716796fec96e3c6f99ef (plain) (blame)
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
{ lib
, buildPythonPackage
, fetchFromGitHub
, hdf5
, numpy
, onnx
, opencv4
, pillow
, pyaml
, pyclipper
, python-bidi
, pythonOlder
, scikit-image
, scipy
, shapely
, torch
, torchvision
}:

buildPythonPackage rec {
  pname = "easyocr";
  version = "1.7.1";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "JaidedAI";
    repo = "EasyOCR";
    rev = "refs/tags/v${version}";
    hash = "sha256-EiiJ2LJ3uYIvgPd2y25MraV5kTa47JalDR7SLbkM9UI=";
  };

  postPatch = ''
    substituteInPlace requirements.txt \
      --replace "opencv-python-headless" "" \
      --replace "ninja" ""
  '';

  propagatedBuildInputs = [
    hdf5
    numpy
    opencv4
    pillow
    pyaml
    pyclipper
    python-bidi
    scikit-image
    scipy
    shapely
    torch
    torchvision
  ];

  nativeCheckInputs = [
    onnx
  ];

  pythonImportsCheck = [
    "easyocr"
  ];

  meta = with lib; {
    description = "Ready-to-use OCR with 80+ supported languages and all popular writing scripts";
    homepage = "https://github.com/JaidedAI/EasyOCR";
    changelog = "https://github.com/JaidedAI/EasyOCR/releases/tag/v${version}";
    license = licenses.asl20;
    maintainers = with maintainers; [ dit7ya ];
  };
}