1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 flit-core,
7 matplotlib,
8 matplotx,
9 numpy,
10 rich,
11 pytestCheckHook,
12 pythonOlder,
13}:
14
15buildPythonPackage rec {
16 pname = "perfplot";
17 version = "0.10.2";
18 format = "pyproject";
19
20 disabled = pythonOlder "3.7";
21
22 src = fetchFromGitHub {
23 owner = "nschloe";
24 repo = "perfplot";
25 tag = "v${version}";
26 hash = "sha256-bu6eYQukhLE8sLkS3PbqTgXOqJFXJYXTcXAhmjaq48g=";
27 };
28
29 nativeBuildInputs = [ flit-core ];
30
31 propagatedBuildInputs = [
32 matplotlib
33 matplotx
34 numpy
35 rich
36 ];
37
38 # This variable is needed to suppress the "Trace/BPT trap: 5" error in Darwin's checkPhase.
39 # Not sure of the details, but we can avoid it by changing the matplotlib backend during testing.
40 env.MPLBACKEND = lib.optionalString stdenv.hostPlatform.isDarwin "Agg";
41
42 nativeCheckInputs = [ pytestCheckHook ];
43
44 pythonImportsCheck = [ "perfplot" ];
45
46 meta = with lib; {
47 description = "Performance plots for Python code snippets";
48 homepage = "https://github.com/nschloe/perfplot";
49 changelog = "https://github.com/nschloe/perfplot/releases/tag/v${version}";
50 license = licenses.mit;
51 maintainers = [ ];
52 };
53}