nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 hdf5,
7 numpy,
8 opencv-python-headless,
9 pillow,
10 pyaml,
11 pyclipper,
12 python-bidi,
13 scikit-image,
14 scipy,
15 shapely,
16 torch,
17 torchvision,
18 python,
19}:
20
21buildPythonPackage rec {
22 pname = "easyocr";
23 version = "1.7.2";
24 pyproject = true;
25
26 src = fetchFromGitHub {
27 owner = "JaidedAI";
28 repo = "EasyOCR";
29 tag = "v${version}";
30 hash = "sha256-9mrAxt2lphYtLW81lGO5SYHsnMnSA/VpHiY2NffD/Js=";
31 };
32
33 build-system = [
34 setuptools
35 ];
36
37 pythonRelaxDeps = [
38 "torchvision"
39 ];
40
41 pythonRemoveDeps = [
42 "ninja"
43 ];
44
45 dependencies = [
46 hdf5
47 numpy
48 opencv-python-headless
49 pillow
50 pyaml
51 pyclipper
52 python-bidi
53 scikit-image
54 scipy
55 shapely
56 torch
57 torchvision
58 ];
59
60 checkPhase = ''
61 runHook preCheck
62
63 export HOME="$(mktemp -d)"
64 pushd unit_test
65 ${python.interpreter} run_unit_test.py --easyocr "$out/${python.sitePackages}/easyocr"
66 popd
67
68 runHook postCheck
69 '';
70
71 # downloads detection model from the internet
72 doCheck = false;
73
74 pythonImportsCheck = [ "easyocr" ];
75
76 meta = {
77 description = "Ready-to-use OCR with 80+ supported languages and all popular writing scripts";
78 mainProgram = "easyocr";
79 homepage = "https://github.com/JaidedAI/EasyOCR";
80 changelog = "https://github.com/JaidedAI/EasyOCR/releases/tag/v${version}";
81 license = lib.licenses.asl20;
82 maintainers = with lib.maintainers; [ dit7ya ];
83 };
84}