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