1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 scipy,
7 numpy,
8 pyqt6,
9 pyopengl,
10 qt6,
11 pytestCheckHook,
12 freefont_ttf,
13 makeFontsConf,
14 setuptools,
15}:
16
17let
18 fontsConf = makeFontsConf { fontDirectories = [ freefont_ttf ]; };
19in
20buildPythonPackage rec {
21 pname = "pyqtgraph";
22 version = "0.13.7";
23 format = "pyproject";
24
25 src = fetchFromGitHub {
26 owner = "pyqtgraph";
27 repo = "pyqtgraph";
28 tag = "pyqtgraph-${version}";
29 hash = "sha256-MUwg1v6oH2TGmJ14Hp9i6KYierJbzPggK59QaHSXHVA=";
30 };
31
32 nativeBuildInputs = [ setuptools ];
33
34 propagatedBuildInputs = [
35 numpy
36 scipy
37 pyopengl
38 ];
39 buildInputs = [
40 # Not propagating it so that every consumer of this package will be able to
41 # use any of the upstream supported Qt Library, See:
42 # https://pyqtgraph.readthedocs.io/en/pyqtgraph-0.13.7/getting_started/how_to_use.html#pyqt-and-pyside
43 pyqt6
44 ];
45
46 nativeCheckInputs = [ pytestCheckHook ];
47
48 preCheck = ''
49 export QT_PLUGIN_PATH="${lib.getBin qt6.qtbase}/${qt6.qtbase.qtPluginPrefix}"
50 export QT_QPA_PLATFORM=offscreen
51 export DYLD_FRAMEWORK_PATH=/System/Library/Frameworks
52 export FONTCONFIG_FILE=${fontsConf}
53 '';
54
55 enabledTestPaths = [
56 # we only want to run unittests
57 "tests"
58 ];
59
60 disabledTests =
61 lib.optionals (!stdenv.hostPlatform.isx86) [
62 # small precision-related differences on other architectures,
63 # upstream doesn't consider it serious.
64 # https://github.com/pyqtgraph/pyqtgraph/issues/2110
65 "test_PolyLineROI"
66 ]
67 ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
68 # https://github.com/pyqtgraph/pyqtgraph/issues/2645
69 "test_rescaleData"
70 ];
71
72 meta = {
73 description = "Scientific Graphics and GUI Library for Python";
74 homepage = "https://www.pyqtgraph.org/";
75 changelog = "https://github.com/pyqtgraph/pyqtgraph/blob/master/CHANGELOG";
76 license = lib.licenses.mit;
77 platforms = lib.platforms.unix;
78 maintainers = with lib.maintainers; [
79 koral
80 doronbehar
81 ];
82 };
83}