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 ] ++ lib.optionals gui [ tkinter ];
87
88 optional-dependencies = {
89 crypto = [ pycryptodome ];
90 db = [
91 pg8000
92 pymysql
93 pyodbc
94 rdflib
95 ];
96 efm = [
97 holidays
98 pytz
99 ];
100 esef = [ tinycss2 ];
101 objectmaker = [ graphviz ];
102 webserver = [
103 cheroot
104 cherrypy
105 tornado
106 ];
107 };
108
109 nativeBuildInputs = [
110 # deps for docs
111 sphinxHook
112 sphinx-autodoc2
113 myst-parser
114 sphinx-copybutton
115 furo
116 ];
117
118 # the arelleGUI executable doesn't work when the gui option is false
119 postInstall = lib.optionalString (!gui) ''
120 find $out/bin -name "*arelleGUI*" -delete
121 '';
122
123 nativeCheckInputs = [
124 pytestCheckHook
125 boto3
126 ] ++ lib.flatten (lib.attrValues optional-dependencies);
127
128 preCheck = ''
129 export HOME=$(mktemp -d)
130 '';
131
132 disabledTestPaths =
133 [
134 "tests/integration_tests"
135 ]
136 ++ lib.optionals (!gui) [
137 # these tests import tkinter
138 "tests/unit_tests/arelle/test_updater.py"
139 "tests/unit_tests/arelle/test_import.py"
140 ];
141
142 meta = {
143 description = "Open source XBRL platform";
144 longDescription = ''
145 An open source facility for XBRL, the eXtensible Business Reporting
146 Language supporting various standards, exposed through a Python or
147 REST API ${lib.optionalString gui " and a graphical user interface"}.
148 '';
149 mainProgram = "arelle";
150 homepage = "http://arelle.org/";
151 license = lib.licenses.asl20;
152 maintainers = with lib.maintainers; [
153 tomasajt
154 roberth
155 ];
156 };
157}