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