1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5, scipy
6, numpy
7, pyqt5
8, pyopengl
9, qt5
10, pytestCheckHook
11, freefont_ttf
12, makeFontsConf
13, fetchpatch
14}:
15
16let
17 fontsConf = makeFontsConf {
18 fontDirectories = [ freefont_ttf ];
19 };
20in
21buildPythonPackage rec {
22 pname = "pyqtgraph";
23 version = "0.12.2";
24
25 src = fetchFromGitHub {
26 owner = "pyqtgraph";
27 repo = "pyqtgraph";
28 rev = "pyqtgraph-${version}";
29 sha256 = "093kkxwj75nb508vz7px4x7lxrwpaff10pl15m4h74hjwyvbsg3d";
30 };
31
32 # TODO: remove when updating to 0.12.3
33 patches = [
34 (fetchpatch {
35 url = "https://github.com/pyqtgraph/pyqtgraph/commit/2de5cd78da92b48e48255be2f41ae332cf8bb675.patch";
36 sha256 = "1hy86psqyl6ipvbg23zvackkd6f7ajs6qll0mbs0x2zmrj92hk00";
37 })
38 ];
39
40 propagatedBuildInputs = [
41 numpy
42 pyqt5
43 scipy
44 pyopengl
45 ];
46
47 checkInputs = [ pytestCheckHook ];
48
49 preCheck = ''
50 export QT_PLUGIN_PATH="${qt5.qtbase.bin}/${qt5.qtbase.qtPluginPrefix}"
51 export QT_QPA_PLATFORM=offscreen
52 export DYLD_FRAMEWORK_PATH=/System/Library/Frameworks
53 export FONTCONFIG_FILE=${fontsConf}
54 '';
55
56 disabledTests = lib.optionals (!stdenv.hostPlatform.isx86) [
57 # small precision-related differences on other architectures,
58 # upstream doesn't consider it serious.
59 # https://github.com/pyqtgraph/pyqtgraph/issues/2110
60 "test_PolyLineROI"
61 ];
62
63 meta = with lib; {
64 description = "Scientific Graphics and GUI Library for Python";
65 homepage = "https://www.pyqtgraph.org/";
66 changelog = "https://github.com/pyqtgraph/pyqtgraph/blob/master/CHANGELOG";
67 license = licenses.mit;
68 platforms = platforms.unix;
69 maintainers = with maintainers; [ koral ];
70 };
71
72}