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