summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/perfplot/default.nix
blob: 30c2bb1dc70f563c91097aa8e16f4fc10819f53a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,
  flit-core,
  matplotlib,
  matplotx,
  numpy,
  rich,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "perfplot";
  version = "0.10.2";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "nschloe";
    repo = "perfplot";
    tag = "v${version}";
    hash = "sha256-bu6eYQukhLE8sLkS3PbqTgXOqJFXJYXTcXAhmjaq48g=";
  };

  nativeBuildInputs = [ flit-core ];

  propagatedBuildInputs = [
    matplotlib
    matplotx
    numpy
    rich
  ];

  # This variable is needed to suppress the "Trace/BPT trap: 5" error in Darwin's checkPhase.
  # Not sure of the details, but we can avoid it by changing the matplotlib backend during testing.
  env.MPLBACKEND = lib.optionalString stdenv.hostPlatform.isDarwin "Agg";

  nativeCheckInputs = [ pytestCheckHook ];

  pythonImportsCheck = [ "perfplot" ];

  meta = {
    description = "Performance plots for Python code snippets";
    homepage = "https://github.com/nschloe/perfplot";
    changelog = "https://github.com/nschloe/perfplot/releases/tag/v${version}";
    license = lib.licenses.mit;
    maintainers = [ ];
  };
}