1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 django,
6 pytestCheckHook,
7 setuptools,
8 celery,
9 django-taggit,
10 feedgen,
11 reportlab,
12 jsonschema,
13 wand,
14 django-filter,
15 django-treebeard,
16 djangorestframework,
17 pikepdf,
18 pypdf,
19 pycryptodome,
20 python-poppler,
21 zipstream-ng,
22 django-json-widget,
23 factory-boy,
24 pytest-django,
25 camelot,
26 pytesseract,
27 pytest-factoryboy,
28 poppler_utils,
29 pytest-playwright,
30 playwright-driver,
31 pnpm,
32 nodejs,
33}:
34
35buildPythonPackage rec {
36 pname = "django-filingcabinet";
37 version = "0-unstable-2024-11-15";
38 pyproject = true;
39
40 src = fetchFromGitHub {
41 owner = "okfde";
42 repo = "django-filingcabinet";
43 # No release tagged yet on GitHub
44 # https://github.com/okfde/django-filingcabinet/issues/69
45 rev = "33c88e1ca9fccd0ea70f8b609580eeec486bda5c";
46 hash = "sha256-p7VJUiO7dhTR+S3/4QrmrQeJO6xGj7D7I8W3CBF+jo8=";
47 };
48
49 postPatch = ''
50 substituteInPlace pyproject.toml \
51 --replace-fail "zipstream" "zipstream-ng"
52 '';
53
54 build-system = [ setuptools ];
55
56 nativeBuildInputs = [
57 nodejs
58 pnpm.configHook
59 ];
60
61 dependencies = [
62 celery
63 django
64 django-filter
65 django-json-widget
66 django-taggit
67 django-treebeard
68 djangorestframework
69 feedgen
70 jsonschema
71 pikepdf
72 pycryptodome
73 pypdf
74 python-poppler
75 reportlab
76 wand
77 zipstream-ng
78 ];
79
80 optional-dependencies = {
81 tabledetection = [ camelot ];
82 ocr = [ pytesseract ];
83 # Dependencies not yet packaged
84 #webp = [ webp ];
85 #annotate = [ fcdocs-annotate ];
86 };
87
88 pnpmDeps = pnpm.fetchDeps {
89 inherit pname version src;
90 hash = "sha256-32kOhB2+37DD4hKXKep08iDxhXpasKPfcv9fkwISxeU=";
91 };
92
93 postBuild = ''
94 pnpm run build
95 '';
96
97 postInstall = ''
98 cp -r build $out/
99 '';
100
101 nativeCheckInputs = [
102 poppler_utils
103 pytest-django
104 pytest-factoryboy
105 pytest-playwright
106 pytestCheckHook
107 ];
108
109 disabledTests = [
110 # AssertionError: Locator expected to be visible
111 "test_keyboard_scroll"
112 "test_number_input_scroll"
113 # playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded
114 "test_sidebar_hide"
115 "test_show_search_bar"
116 ];
117
118 preCheck = ''
119 export DJANGO_SETTINGS_MODULE="test_project.settings"
120 export PLAYWRIGHT_BROWSERS_PATH="${playwright-driver.browsers}"
121 '';
122
123 pythonImportCheck = [ "filingcabinet" ];
124
125 meta = {
126 description = "Django app that manages documents with pages, annotations and collections";
127 homepage = "https://github.com/okfde/django-filingcabinet";
128 license = lib.licenses.mit;
129 maintainers = [ lib.maintainers.onny ];
130 };
131}