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