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