1{ lib
2, fetchFromGitHub
3, ghostscript
4, imagemagick
5, poppler_utils
6, python3
7, tesseract5
8}:
9
10python3.pkgs.buildPythonApplication rec {
11 pname = "invoice2data";
12 version = "0.4.2";
13 format = "setuptools";
14
15 src = fetchFromGitHub {
16 owner = "invoice-x";
17 repo = pname;
18 rev = "v${version}";
19 sha256 = "sha256-ss2h8cg0sga+lzJyQHckrZB/Eb63Oj3FkqmGqWCzCQ8=";
20 };
21
22 buildInputs = with python3.pkgs; [ setuptools-git ];
23
24 propagatedBuildInputs = with python3.pkgs; [
25 chardet
26 dateparser
27 pdfminer-six
28 pillow
29 pyyaml
30 setuptools
31 unidecode
32 ];
33
34 postPatch = ''
35 substituteInPlace setup.cfg \
36 --replace "pytest-runner" ""
37 '';
38
39 makeWrapperArgs = ["--prefix" "PATH" ":" (lib.makeBinPath [
40 ghostscript
41 imagemagick
42 tesseract5
43 poppler_utils
44 ])];
45
46 # Tests fails even when ran manually on my ubuntu machine !!
47 doCheck = false;
48
49 pythonImportsCheck = [
50 "invoice2data"
51 ];
52
53 meta = with lib; {
54 description = "Data extractor for PDF invoices";
55 homepage = "https://github.com/invoice-x/invoice2data";
56 license = licenses.mit;
57 maintainers = with maintainers; [ psyanticy ];
58 };
59}