1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 setuptools,
7 setuptools-scm,
8
9 bottle,
10 certifi,
11 filelock,
12 isodate,
13 jsonschema,
14 lxml,
15 numpy,
16 openpyxl,
17 pillow,
18 pyparsing,
19 python-dateutil,
20 regex,
21 truststore,
22 typing-extensions,
23
24 gui ? true,
25 tkinter,
26
27 aniso8601,
28 pycryptodome,
29 pg8000,
30 pymysql,
31 pyodbc,
32 rdflib,
33 holidays,
34 pytz,
35 tinycss2,
36 graphviz,
37 cheroot,
38 cherrypy,
39 tornado,
40
41 sphinxHook,
42 sphinx-autodoc2,
43 myst-parser,
44 sphinx-copybutton,
45 furo,
46
47 pytestCheckHook,
48 boto3,
49}:
50
51buildPythonPackage rec {
52 pname = "arelle${lib.optionalString (!gui) "-headless"}";
53 version = "2.37.61";
54 pyproject = true;
55
56 src = fetchFromGitHub {
57 owner = "Arelle";
58 repo = "Arelle";
59 tag = version;
60 hash = "sha256-xz3sDAgE1Qpml8V+2y+q/tTda6uGZuMnNSEGdIjLlzI=";
61 };
62
63 outputs = [
64 "out"
65 "doc"
66 ];
67
68 postPatch = ''
69 substituteInPlace pyproject.toml --replace-fail \
70 'requires = ["setuptools>=80.9,<81", "wheel>=0.45,<1", "setuptools_scm[toml]>=9.2,<10"]' \
71 'requires = ["setuptools", "wheel", "setuptools_scm[toml]"]'
72 '';
73
74 build-system = [
75 setuptools
76 setuptools-scm
77 ];
78
79 dependencies = [
80 bottle
81 certifi
82 filelock
83 isodate
84 jsonschema
85 lxml
86 numpy
87 openpyxl
88 pillow
89 pyparsing
90 python-dateutil
91 regex
92 truststore
93 typing-extensions
94 ]
95 ++ lib.optionals gui [ tkinter ];
96
97 optional-dependencies = {
98 crypto = [ pycryptodome ];
99 db = [
100 pg8000
101 pymysql
102 pyodbc
103 rdflib
104 ];
105 efm = [
106 holidays
107 pytz
108 ];
109 esef = [ tinycss2 ];
110 objectmaker = [ graphviz ];
111 webserver = [
112 cheroot
113 cherrypy
114 tornado
115 ];
116 xule = [ aniso8601 ];
117 };
118
119 nativeBuildInputs = [
120 # deps for docs
121 sphinxHook
122 sphinx-autodoc2
123 myst-parser
124 sphinx-copybutton
125 furo
126 ];
127
128 # the arelleGUI executable doesn't work when the gui option is false
129 postInstall = lib.optionalString (!gui) ''
130 find $out/bin -name "*arelleGUI*" -delete
131 '';
132
133 nativeCheckInputs = [
134 pytestCheckHook
135 boto3
136 ]
137 ++ lib.flatten (lib.attrValues optional-dependencies);
138
139 preCheck = ''
140 export HOME=$(mktemp -d)
141 '';
142
143 disabledTestPaths = [
144 "tests/integration_tests"
145 ]
146 ++ lib.optionals (!gui) [
147 # these tests import tkinter
148 "tests/unit_tests/arelle/test_updater.py"
149 "tests/unit_tests/arelle/test_import.py"
150 ];
151
152 meta = {
153 description = "Open source XBRL platform";
154 longDescription = ''
155 An open source facility for XBRL, the eXtensible Business Reporting
156 Language supporting various standards, exposed through a Python or
157 REST API ${lib.optionalString gui " and a graphical user interface"}.
158 '';
159 mainProgram = "arelle";
160 homepage = "http://arelle.org/";
161 license = lib.licenses.asl20;
162 maintainers = with lib.maintainers; [
163 tomasajt
164 roberth
165 ];
166 };
167}