nixpkgs/pkgs/development/python-modules/easyocr/default.nix
stuebinm ff1a94e523 treewide: add meta.mainProgram to packages with a single binary
The nixpkgs-unstable channel's programs.sqlite was used to identify
packages producing exactly one binary, and these automatically added
to their package definitions wherever possible.
2024-03-19 03:14:51 +01:00

71 lines
1.2 KiB
Nix

{ 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";
mainProgram = "easyocr";
homepage = "https://github.com/JaidedAI/EasyOCR";
changelog = "https://github.com/JaidedAI/EasyOCR/releases/tag/v${version}";
license = licenses.asl20;
maintainers = with maintainers; [ dit7ya ];
};
}