Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / orange3 / default.nix
blob1100ae7f6dc6e972e4d8bab4f5ae41b92b82389f
1 { lib
2 , baycomp
3 , bottleneck
4 , buildPythonPackage
5 , chardet
6 , copyDesktopItems
7 , cython
8 , fetchFromGitHub
9 , fetchurl
10 , httpx
11 , joblib
12 , keyring
13 , keyrings-alt
14 , makeDesktopItem
15 , matplotlib
16 , nix-update-script
17 , numpy
18 , oldest-supported-numpy
19 , openpyxl
20 , opentsne
21 , orange-canvas-core
22 , orange-widget-base
23 , pandas
24 , pyqtgraph
25 , pyqtwebengine
26 , python
27 , python-louvain
28 , pythonOlder
29 , pyyaml
30 , qt5
31 , qtconsole
32 , recommonmark
33 , requests
34 , scikit-learn
35 , scipy
36 , serverfiles
37 , setuptools
38 , sphinx
39 , wheel
40 , xlrd
41 , xlsxwriter
44 let
45   self = buildPythonPackage rec {
46     pname = "orange3";
47     version = "3.36.2";
49     disabled = pythonOlder "3.7";
51     src = fetchFromGitHub {
52       owner = "biolab";
53       repo = "orange3";
54       rev = "refs/tags/${version}";
55       hash = "sha256-v9lk5vGhBaR2PHZ+Jq0hy1WaCsbeLe+vZlTaHBkfacU=";
56     };
58     postPatch = ''
59       substituteInPlace pyproject.toml \
60         --replace "setuptools>=41.0.0,<50.0" "setuptools"
61       sed -i 's;\(scikit-learn\)[^$]*;\1;g' requirements-core.txt
62       sed -i 's;pyqtgraph[^$]*;;g' requirements-gui.txt # TODO: remove after bump with a version greater than 0.13.1
63     '';
65     nativeBuildInputs = [
66       copyDesktopItems
67       cython
68       oldest-supported-numpy
69       qt5.wrapQtAppsHook
70       recommonmark
71       setuptools
72       sphinx
73       wheel
74     ];
76     enableParallelBuilding = true;
78     propagatedBuildInputs = [
79       numpy
80       scipy
81       chardet
82       openpyxl
83       opentsne
84       qtconsole
85       bottleneck
86       matplotlib
87       joblib
88       requests
89       keyring
90       scikit-learn
91       pandas
92       pyqtwebengine
93       serverfiles
94       orange-canvas-core
95       python-louvain
96       xlrd
97       xlsxwriter
98       httpx
99       pyqtgraph
100       orange-widget-base
101       keyrings-alt
102       pyyaml
103       baycomp
104     ];
106     # 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)
107     doCheck = false;
109     pythonImportsCheck = [ "Orange" "Orange.data._variable" ];
111     desktopItems = [
112       (makeDesktopItem {
113         name = "orange";
114         exec = "orange-canvas";
115         desktopName = "Orange Data Mining";
116         genericName = "Data Mining Suite";
117         comment = "Explore, analyze, and visualize your data";
118         icon = "orange-canvas";
119         mimeTypes = [ "application/x-extension-ows" ];
120         categories = [ "Science" "Education" "ArtificialIntelligence" "DataVisualization" "NumericalAnalysis" "Qt" ];
121         keywords = [ "Machine Learning" "Scientific Visualization" "Statistical Analysis" ];
122       })
123     ];
125     postInstall = ''
126       wrapProgram $out/bin/orange-canvas \
127         "${"$"}{qtWrapperArgs[@]}"
128       mkdir -p $out/share/icons/hicolor/{256x256,48x48}/apps
129       cp distribute/icon-256.png $out/share/icons/hicolor/256x256/apps/orange-canvas.png
130       cp distribute/icon-48.png $out/share/icons/hicolor/48x48/apps/orange-canvas.png
131     '';
133     passthru = {
134       updateScript = nix-update-script { };
135       tests.unittests = self.overridePythonAttrs (old: {
136         pname = "${old.pname}-tests";
137         format = "other";
139         preCheck = ''
140           export HOME=$(mktemp -d)
141           export QT_PLUGIN_PATH="${qt5.qtbase.bin}/${qt5.qtbase.qtPluginPrefix}"
142           export QT_QPA_PLATFORM_PLUGIN_PATH="${qt5.qtbase.bin}/lib/qt-${qt5.qtbase.version}/plugins";
143           export QT_QPA_PLATFORM=offscreen
145           rm Orange -rf
146           cp -r ${self}/${python.sitePackages}/Orange .
147           chmod +w -R .
149           rm Orange/tests/test_url_reader.py # uses network
150           rm Orange/tests/test_ada_boost.py # broken: The 'base_estimator' parameter of AdaBoostRegressor must be an object implementing 'fit' and 'predict' or a str among {'deprecated'}. Got None instead.
151         '';
153         checkPhase = ''
154           runHook preCheck
155           ${python.interpreter} -m unittest -b -v ./Orange/**/test*.py
156           runHook postCheck
157         '';
159         postInstall = "";
161         doBuild = false;
162         doInstall = false;
164         nativeBuildInputs = [ self ] ++ old.nativeBuildInputs;
165       });
166     };
168     meta = with lib; {
169       description = "Data mining and visualization toolbox for novice and expert alike";
170       homepage = "https://orangedatamining.com/";
171       changelog = "https://github.com/biolab/orange3/blob/${version}/CHANGELOG.md";
172       license = with licenses; [ gpl3Plus ];
173       maintainers = with maintainers; [ lucasew ];
174       mainProgram = "orange-canvas";
175     };
176   };
178 self