1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 oldest-supported-numpy,
9 setuptools,
10
11 # nativeBuildInputs
12 copyDesktopItems,
13 cython,
14 qt5,
15 recommonmark,
16 sphinx,
17
18 # dependencies
19 baycomp,
20 bottleneck,
21 catboost,
22 chardet,
23 httpx,
24 joblib,
25 keyring,
26 keyrings-alt,
27 matplotlib,
28 numpy,
29 openpyxl,
30 opentsne,
31 orange-canvas-core,
32 orange-widget-base,
33 pandas,
34 pip,
35 pyqt5,
36 pyqtgraph,
37 pyqtwebengine,
38 python-louvain,
39 pyyaml,
40 qtconsole,
41 requests,
42 scikit-learn,
43 scipy,
44 serverfiles,
45 xgboost,
46 xlrd,
47 xlsxwriter,
48
49 makeDesktopItem,
50
51 # passthru
52 gitUpdater,
53 python,
54 pytest-qt,
55 pytestCheckHook,
56}:
57
58let
59 self = buildPythonPackage rec {
60 pname = "orange3";
61 version = "3.39.0";
62 pyproject = true;
63
64 src = fetchFromGitHub {
65 owner = "biolab";
66 repo = "orange3";
67 tag = version;
68 hash = "sha256-P2e3Wq33UXnTmGSxkoW8kYYCBfYBB9Z50v4g7n//Fbw=";
69 };
70
71 build-system = [
72 oldest-supported-numpy
73 setuptools
74 ];
75
76 postPatch = ''
77 substituteInPlace pyproject.toml \
78 --replace-fail 'cython>=3.0' 'cython'
79
80 # disable update checking
81 echo -e "def check_for_updates():\n\tpass" >> Orange/canvas/__main__.py
82 '';
83
84 nativeBuildInputs = [
85 copyDesktopItems
86 cython
87 qt5.wrapQtAppsHook
88 recommonmark
89 sphinx
90 ];
91
92 enableParallelBuilding = true;
93
94 pythonRelaxDeps = [ "scikit-learn" ];
95
96 dependencies = [
97 baycomp
98 bottleneck
99 catboost
100 chardet
101 httpx
102 joblib
103 keyring
104 keyrings-alt
105 matplotlib
106 numpy
107 openpyxl
108 opentsne
109 orange-canvas-core
110 orange-widget-base
111 pandas
112 pip
113 pyqt5
114 pyqtgraph
115 pyqtwebengine
116 python-louvain
117 pyyaml
118 qtconsole
119 requests
120 scikit-learn
121 scipy
122 serverfiles
123 setuptools
124 xgboost
125 xlrd
126 xlsxwriter
127 ];
128
129 # FIXME: ImportError: cannot import name '_variable' from partially initialized module 'Orange.data' (most likely due to a circular import) (/build/source/Orange/data/__init__.py)
130 doCheck = false;
131
132 # FIXME: pythonRelaxDeps is not relaxing the scikit-learn version constraint, had to disable this
133 dontCheckRuntimeDeps = true;
134
135 pythonImportsCheck = [
136 "Orange"
137 "Orange.data._variable"
138 ];
139
140 desktopItems = [
141 (makeDesktopItem {
142 name = "orange";
143 exec = "orange-canvas";
144 desktopName = "Orange Data Mining";
145 genericName = "Data Mining Suite";
146 comment = "Explore, analyze, and visualize your data";
147 icon = "orange-canvas";
148 mimeTypes = [ "application/x-extension-ows" ];
149 categories = [
150 "Science"
151 "Education"
152 "ArtificialIntelligence"
153 "DataVisualization"
154 "NumericalAnalysis"
155 "Qt"
156 ];
157 keywords = [
158 "Machine Learning"
159 "Scientific Visualization"
160 "Statistical Analysis"
161 ];
162 })
163 ];
164
165 postInstall = ''
166 wrapProgram $out/bin/orange-canvas \
167 "${"$"}{qtWrapperArgs[@]}"
168 mkdir -p $out/share/icons/hicolor/{256x256,48x48}/apps
169 cp distribute/icon-256.png $out/share/icons/hicolor/256x256/apps/orange-canvas.png
170 cp distribute/icon-48.png $out/share/icons/hicolor/48x48/apps/orange-canvas.png
171 '';
172
173 passthru = {
174 updateScript = gitUpdater { };
175 tests.unittests = stdenv.mkDerivation {
176 name = "${self.name}-tests";
177 inherit (self) src;
178
179 preCheck = ''
180 export HOME=$(mktemp -d)
181 export QT_PLUGIN_PATH="${qt5.qtbase.bin}/${qt5.qtbase.qtPluginPrefix}"
182 export QT_QPA_PLATFORM_PLUGIN_PATH="${qt5.qtbase.bin}/lib/qt-${qt5.qtbase.version}/plugins";
183 export QT_QPA_PLATFORM=offscreen
184
185 rm Orange -rf
186 cp -r ${self}/${python.sitePackages}/Orange .
187 chmod +w -R .
188
189 substituteInPlace Orange/classification/tests/test_xgb_cls.py \
190 --replace-fail test_learners mk_test_learners
191
192 substituteInPlace Orange/modelling/tests/test_xgb.py \
193 --replace-fail test_learners mk_test_learners
194
195 substituteInPlace Orange/**/tests/*.py \
196 --replace-fail test_filename filename_test
197
198 # TODO: debug why orange is crashing on GC, may be a upstream issue
199 chmod +x Orange/__init__.py
200 echo "import gc; gc.disable()" | tee -a Orange/__init__.py
201
202 '';
203
204 nativeBuildInputs = [
205 pytest-qt
206 pytestCheckHook
207 ];
208
209 postCheck = ''
210 touch $out
211 '';
212
213 doBuild = false;
214 doInstall = false;
215
216 buildInputs = [ self ];
217 };
218 };
219
220 meta = {
221 description = "Data mining and visualization toolbox for novice and expert alike";
222 homepage = "https://orangedatamining.com/";
223 changelog = "https://github.com/biolab/orange3/blob/${src.tag}/CHANGELOG.md";
224 license = [ lib.licenses.gpl3Plus ];
225 maintainers = [ lib.maintainers.lucasew ];
226 mainProgram = "orange-canvas";
227 };
228 };
229in
230self