1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 setuptools,
9
10 # dependencies
11 distutils,
12 h5py,
13 numpy,
14 qtpy,
15 requests,
16 tomli,
17
18 # tests
19 pytestCheckHook,
20 qt6,
21 pyqt6,
22
23 # passthru.tests
24 guidata,
25 pyside6,
26 qt5,
27 pyqt5,
28 pyside2,
29}:
30
31buildPythonPackage rec {
32 pname = "guidata";
33 version = "3.12.0";
34 pyproject = true;
35
36 src = fetchFromGitHub {
37 owner = "PlotPyStack";
38 repo = "guidata";
39 tag = "v${version}";
40 hash = "sha256-dh1WyUgJ+rkBFtcyXEFgU8UNPQEkJfiJBwmkT1eqKoI=";
41 };
42
43 build-system = [
44 setuptools
45 ];
46
47 dependencies = [
48 distutils
49 h5py
50 numpy
51 qtpy
52 requests
53 tomli
54 ];
55
56 nativeCheckInputs = [
57 pytestCheckHook
58 # Not propagating this, to allow one to choose to choose a pyqt / pyside
59 # implementation.
60 pyqt6
61 ];
62
63 preCheck = ''
64 export QT_PLUGIN_PATH="${lib.getBin qt6.qtbase}/${qt6.qtbase.qtPluginPrefix}"
65 export QT_QPA_PLATFORM=offscreen
66 '';
67
68 disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
69 # Fatal Python error: Segmentation fault
70 # guidata/dataset/qtitemwidgets.py", line 633 in __init__
71 "test_all_items"
72 "test_loadsave_hdf5"
73 "test_loadsave_json"
74 # guidata/dataset/qtitemwidgets.py", line 581 in __init__
75 "test_editgroupbox"
76 "test_item_order"
77 # guidata/qthelpers.py", line 710 in exec_dialog
78 "test_arrayeditor"
79 ];
80
81 pythonImportsCheck = [ "guidata" ];
82
83 passthru = {
84 tests = {
85 withPyQt6 = guidata.override {
86 pyqt6 = pyqt6;
87 qt6 = qt6;
88 };
89 withPySide6 = guidata.override {
90 pyqt6 = pyside6;
91 qt6 = qt6;
92 };
93 withPyQt5 = guidata.override {
94 pyqt6 = pyqt5;
95 qt6 = qt5;
96 };
97 };
98 # Upstream doesn't officially supports all of them, although they use qtpy,
99 # see: https://github.com/PlotPyStack/PlotPy/issues/20 . See also the
100 # comment near this attribute at plotpy
101 knownFailingTests = {
102 withPySide2 = guidata.override {
103 pyqt6 = pyside2;
104 qt6 = qt5;
105 };
106 };
107 };
108
109 meta = {
110 description = "Python library generating graphical user interfaces for easy dataset editing and display";
111 homepage = "https://github.com/PlotPyStack/guidata";
112 changelog = "https://github.com/PlotPyStack/guidata/blob/${src.tag}/CHANGELOG.md";
113 license = lib.licenses.bsd3;
114 maintainers = with lib.maintainers; [ doronbehar ];
115 };
116}