1{ lib
2, buildPythonPackage
3, distro
4, fetchFromGitHub
5, jre
6, numpy
7, pandas
8, pytestCheckHook
9, pythonOlder
10, setuptools-scm
11, setuptools
12}:
13
14buildPythonPackage rec {
15 pname = "tabula-py";
16 version = "2.8.1";
17 format = "pyproject";
18
19 disabled = pythonOlder "3.8";
20
21 src = fetchFromGitHub {
22 owner = "chezou";
23 repo = pname;
24 rev = "refs/tags/v${version}";
25 hash = "sha256-QqTfbSwGaNRXBiAzB1fsEawxCvlIunB1j2jSFD9imPI=";
26 };
27
28 patches = [
29 ./java-interpreter-path.patch
30 ];
31
32 postPatch = ''
33 sed -i 's|@JAVA@|${jre}/bin/java|g' $(find -name '*.py')
34 '';
35
36 SETUPTOOLS_SCM_PRETEND_VERSION = version;
37
38 nativeBuildInputs = [
39 setuptools-scm
40 ];
41
42 propagatedBuildInputs = [
43 distro
44 numpy
45 pandas
46 setuptools
47 ];
48
49 nativeCheckInputs = [
50 pytestCheckHook
51 ];
52
53 pythonImportsCheck = [
54 "tabula"
55 ];
56
57 disabledTests = [
58 # Tests require network access
59 "test_convert_remote_file"
60 "test_read_pdf_with_remote_template"
61 "test_read_remote_pdf"
62 "test_read_remote_pdf_with_custom_user_agent"
63 ];
64
65 meta = with lib; {
66 description = "Module to extract table from PDF into pandas DataFrame";
67 homepage = "https://github.com/chezou/tabula-py";
68 changelog = "https://github.com/chezou/tabula-py/releases/tag/v${version}";
69 license = licenses.mit;
70 maintainers = with maintainers; [ fab ];
71 };
72}