1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 scipy,
7 numpy,
8 pyqt5,
9 pyopengl,
10 qt5,
11 pytestCheckHook,
12 freefont_ttf,
13 makeFontsConf,
14 setuptools,
15 python,
16}:
17
18let
19 fontsConf = makeFontsConf { fontDirectories = [ freefont_ttf ]; };
20in
21buildPythonPackage rec {
22 pname = "pyqtgraph";
23 version = "0.13.7";
24 format = "pyproject";
25
26 src = fetchFromGitHub {
27 owner = "pyqtgraph";
28 repo = "pyqtgraph";
29 rev = "refs/tags/pyqtgraph-${version}";
30 hash = "sha256-MUwg1v6oH2TGmJ14Hp9i6KYierJbzPggK59QaHSXHVA=";
31 };
32
33 nativeBuildInputs = [ setuptools ];
34
35 propagatedBuildInputs = [
36 numpy
37 pyqt5
38 scipy
39 pyopengl
40 ];
41
42 nativeCheckInputs = [ pytestCheckHook ];
43
44 preCheck = ''
45 export QT_PLUGIN_PATH="${qt5.qtbase.bin}/${qt5.qtbase.qtPluginPrefix}"
46 export QT_QPA_PLATFORM=offscreen
47 export DYLD_FRAMEWORK_PATH=/System/Library/Frameworks
48 export FONTCONFIG_FILE=${fontsConf}
49 '';
50
51 pytestFlagsArray = [
52 # we only want to run unittests
53 "tests"
54 ];
55
56 disabledTests =
57 lib.optionals (!stdenv.hostPlatform.isx86) [
58 # small precision-related differences on other architectures,
59 # upstream doesn't consider it serious.
60 # https://github.com/pyqtgraph/pyqtgraph/issues/2110
61 "test_PolyLineROI"
62 ]
63 ++ lib.optionals (stdenv.isLinux && stdenv.isAarch64) [
64 # https://github.com/pyqtgraph/pyqtgraph/issues/2645
65 "test_rescaleData"
66 ];
67
68 meta = with lib; {
69 description = "Scientific Graphics and GUI Library for Python";
70 homepage = "https://www.pyqtgraph.org/";
71 changelog = "https://github.com/pyqtgraph/pyqtgraph/blob/master/CHANGELOG";
72 license = licenses.mit;
73 broken = lib.versionAtLeast python.version "3.12";
74 platforms = platforms.unix;
75 maintainers = with maintainers; [ koral ];
76 };
77}