1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 substituteAll,
6 fetchPypi,
7 cython,
8 fontconfig,
9 freetype-py,
10 hsluv,
11 kiwisolver,
12 libGL,
13 numpy,
14 oldest-supported-numpy,
15 packaging,
16 pythonOlder,
17 setuptools,
18 setuptools-scm,
19 wheel,
20}:
21
22buildPythonPackage rec {
23 pname = "vispy";
24 version = "0.14.3";
25 pyproject = true;
26
27 disabled = pythonOlder "3.7";
28
29 src = fetchPypi {
30 inherit pname version;
31 hash = "sha256-77u4R6kIuvfnFpq5vylhOKOTZPNn5ssKjsA61xaZ0x0=";
32 };
33
34 postPatch = ''
35 # https://numpy.org/devdocs/dev/depending_on_numpy.html#numpy-2-0-specific-advice
36 # upstream enforce builds with numpy 2+, which is backward compat with 1.xx
37 substituteInPlace pyproject.toml \
38 --replace-fail "numpy>=2.0.0rc2" "numpy"
39 '';
40
41 patches = lib.optionals (!stdenv.hostPlatform.isDarwin) [
42 (substituteAll {
43 src = ./library-paths.patch;
44 fontconfig = "${fontconfig.lib}/lib/libfontconfig${stdenv.hostPlatform.extensions.sharedLibrary}";
45 gl = "${libGL.out}/lib/libGL${stdenv.hostPlatform.extensions.sharedLibrary}";
46 })
47 ];
48
49 nativeBuildInputs = [
50 cython
51 oldest-supported-numpy
52 setuptools
53 setuptools-scm
54 wheel
55 ];
56
57 buildInputs = [ libGL ];
58
59 propagatedBuildInputs = [
60 freetype-py
61 hsluv
62 kiwisolver
63 numpy
64 packaging
65 ];
66
67 doCheck = false; # otherwise runs OSX code on linux.
68
69 pythonImportsCheck = [
70 "vispy"
71 "vispy.color"
72 "vispy.geometry"
73 "vispy.gloo"
74 "vispy.glsl"
75 "vispy.io"
76 "vispy.plot"
77 "vispy.scene"
78 "vispy.util"
79 "vispy.visuals"
80 ];
81
82 meta = with lib; {
83 description = "Interactive scientific visualization in Python";
84 homepage = "https://vispy.org/index.html";
85 changelog = "https://github.com/vispy/vispy/blob/v${version}/CHANGELOG.md";
86 license = licenses.bsd3;
87 maintainers = with maintainers; [ goertzenator ];
88 };
89}