2024-05-15 15:35:15 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
distro,
|
|
|
|
fetchFromGitHub,
|
|
|
|
jre,
|
|
|
|
numpy,
|
|
|
|
pandas,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
setuptools,
|
|
|
|
setuptools-scm,
|
|
|
|
jpype1,
|
2022-06-26 10:26:21 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "tabula-py";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "2.9.1";
|
2024-01-02 11:29:13 +00:00
|
|
|
pyproject = true;
|
2022-06-26 10:26:21 +00:00
|
|
|
|
2023-02-22 10:55:15 +00:00
|
|
|
disabled = pythonOlder "3.8";
|
2022-06-26 10:26:21 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "chezou";
|
2024-01-02 11:29:13 +00:00
|
|
|
repo = "tabula-py";
|
2022-12-28 21:21:41 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-C06du4mhpnF2qxcEMZxp5O/8xpNaj9Jp8LFaxBkGF/Q=";
|
2022-06-26 10:26:21 +00:00
|
|
|
};
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
postPatch = ''
|
2023-11-16 04:20:00 +00:00
|
|
|
substituteInPlace tabula/backend.py \
|
2024-05-15 15:35:15 +00:00
|
|
|
--replace-fail '"java"' '"${lib.getExe jre}"'
|
2022-12-17 10:02:37 +00:00
|
|
|
'';
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
build-system = [
|
2023-11-16 04:20:00 +00:00
|
|
|
setuptools
|
2022-06-26 10:26:21 +00:00
|
|
|
setuptools-scm
|
|
|
|
];
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
buildInputs = [ jre ];
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
dependencies = [
|
2022-06-26 10:26:21 +00:00
|
|
|
distro
|
|
|
|
numpy
|
|
|
|
pandas
|
2023-11-16 04:20:00 +00:00
|
|
|
jpype1
|
2022-06-26 10:26:21 +00:00
|
|
|
];
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2022-06-26 10:26:21 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
pythonImportsCheck = [ "tabula" ];
|
2022-06-26 10:26:21 +00:00
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# Tests require network access
|
|
|
|
"test_convert_remote_file"
|
|
|
|
"test_read_pdf_with_remote_template"
|
|
|
|
"test_read_remote_pdf"
|
|
|
|
"test_read_remote_pdf_with_custom_user_agent"
|
2023-11-16 04:20:00 +00:00
|
|
|
# not sure what it checks
|
|
|
|
# probably related to jpype, but we use subprocess instead
|
|
|
|
# https://github.com/chezou/tabula-py/issues/352#issuecomment-1730791540
|
|
|
|
# Failed: DID NOT RAISE <class 'RuntimeError'>
|
|
|
|
"test_read_pdf_with_silent_true"
|
2022-06-26 10:26:21 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Module to extract table from PDF into pandas DataFrame";
|
|
|
|
homepage = "https://github.com/chezou/tabula-py";
|
2022-12-28 21:21:41 +00:00
|
|
|
changelog = "https://github.com/chezou/tabula-py/releases/tag/v${version}";
|
2022-06-26 10:26:21 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ fab ];
|
|
|
|
};
|
|
|
|
}
|