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