diff --git a/pkgs/development/python-modules/camelot/default.nix b/pkgs/development/python-modules/camelot/default.nix index be72b9b1488e..1f95916baff0 100644 --- a/pkgs/development/python-modules/camelot/default.nix +++ b/pkgs/development/python-modules/camelot/default.nix @@ -1,31 +1,39 @@ { - buildPythonPackage, - chardet, - charset-normalizer, - click, - fetchPypi, lib, + pkgs, + fetchFromGitHub, + buildPythonPackage, + + # build system + setuptools, + + # dependencies + chardet, + click, + numpy, opencv-python-headless, openpyxl, pandas, pdfminer-six, pillow, - pkgs, pypdf, pypdfium2, - setuptools, tabulate, -}: -buildPythonPackage rec { + # tests + pytestCheckHook, + matplotlib, +}: +buildPythonPackage (finalAttrs: { pname = "camelot-py"; version = "1.0.9"; pyproject = true; - src = fetchPypi { - pname = "camelot_py"; - inherit version; - hash = "sha256-1D2Idm98NGKAP/EUZOfT0VqSI+hFly3ith73w/YtMgA="; + src = fetchFromGitHub { + owner = "camelot-dev"; + repo = "camelot"; + tag = "v${finalAttrs.version}"; + sha256 = "sha256-msf49Vt0IlwUNTvLIqTWKlMfcFB0LnvGGf7vReqhJec="; }; patches = [ ./ghostscript.patch ]; @@ -40,9 +48,8 @@ buildPythonPackage rec { build-system = [ setuptools ]; dependencies = [ - chardet - charset-normalizer click + numpy opencv-python-headless openpyxl pandas @@ -51,9 +58,27 @@ buildPythonPackage rec { pypdf pypdfium2 tabulate + # Dependency not present in project's pyproject.toml, but doesn't build without it + chardet ]; - doCheck = false; + nativeCheckInputs = [ + pytestCheckHook + matplotlib + ]; + disabledTests = [ + # Assertion Error: != + "test_repr_ghostscript" + # cv2.error: color.cpp failure + "test_repr_ghostscript_custom_backend" + # urllib.error.URLError: temporary failure in name + "test_url_pdfium" + "test_url_ghostscript" + "test_url_ghost_script_custom_backend" + "test_pages_pdfium" + "test_pages_ghostscript" + "test_pages_ghostscript_custom_backend" + ]; pythonImportsCheck = [ "camelot" ]; @@ -61,8 +86,8 @@ buildPythonPackage rec { description = "Python library to extract tabular data from PDFs"; mainProgram = "camelot"; homepage = "http://camelot-py.readthedocs.io"; - changelog = "https://github.com/camelot-dev/camelot/blob/v${version}/HISTORY.md"; + changelog = "https://github.com/camelot-dev/camelot/blob/${finalAttrs.src.tag}/HISTORY.md"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ _2gn ]; }; -} +})