1{
2 lib,
3 buildPythonPackage,
4 chardet,
5 diff-match-patch,
6 django,
7 fetchFromGitHub,
8 psycopg2,
9 python,
10 pythonOlder,
11 pythonRelaxDepsHook,
12 pytz,
13 setuptools-scm,
14 tablib,
15}:
16
17buildPythonPackage rec {
18 pname = "django-import-export";
19 version = "4.0.3";
20 pyproject = true;
21
22 disabled = pythonOlder "3.7";
23
24 src = fetchFromGitHub {
25 owner = "django-import-export";
26 repo = "django-import-export";
27 rev = "refs/tags/${version}";
28 hash = "sha256-ItJx9yJSy88/OvkpjGDWGBOMk5YlSquicSWi0tbKeWE=";
29 };
30
31 pythonRelaxDeps = [ "tablib" ];
32
33 build-system = [ setuptools-scm ];
34
35 nativeBuildInputs = [ pythonRelaxDepsHook ];
36
37 dependencies = [
38 diff-match-patch
39 django
40 tablib
41 ];
42
43 passthru.optional-dependencies = {
44 all = [ tablib ] ++ tablib.optional-dependencies.all;
45 cli = [ tablib ] ++ tablib.optional-dependencies.cli;
46 ods = [ tablib ] ++ tablib.optional-dependencies.ods;
47 pandas = [ tablib ] ++ tablib.optional-dependencies.pandas;
48 xls = [ tablib ] ++ tablib.optional-dependencies.xls;
49 xlsx = [ tablib ] ++ tablib.optional-dependencies.xlsx;
50 yaml = [ tablib ] ++ tablib.optional-dependencies.yaml;
51 };
52
53 nativeCheckInputs = [
54 chardet
55 psycopg2
56 pytz
57 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
58
59 checkPhase = ''
60 runHook preCheck
61 ${python.interpreter} tests/manage.py test core --settings=settings
62 runHook postCheck
63 '';
64
65 pythonImportsCheck = [ "import_export" ];
66
67 meta = with lib; {
68 description = "Django application and library for importing and exporting data with admin integration";
69 homepage = "https://github.com/django-import-export/django-import-export";
70 changelog = "https://github.com/django-import-export/django-import-export/blob/${version}/docs/changelog.rst";
71 license = licenses.bsd2;
72 maintainers = with maintainers; [ sephi ];
73 };
74}