about summary refs log tree commit diff
path: root/pkgs/development/python-modules/scalene/default.nix
blob: 18eebe07cc19840388243f2f5b9477447c015c2d (plain) (blame)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{ lib
, buildPythonPackage
, hypothesis
, fetchpatch
, fetchPypi
, setuptools
, setuptools-scm
, cloudpickle
, cython
, jinja2
, numpy
, psutil
, pynvml
, pytestCheckHook
, pythonOlder
, rich
}:

buildPythonPackage rec {
  pname = "scalene";
  version = "1.5.39";
  pyproject = true;
  disabled = pythonOlder "3.9";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-B4pDLP3+56toQZyvh6+6NimCKv0cpcO0ydcqV1tJZkg=";
  };

  patches = [
    # fix scalene_config import. remove on next update
    (fetchpatch {
      name = "scalene_config-import-fix.patch";
      url = "https://github.com/plasma-umass/scalene/commit/cd437be11f600ac0925ce77efa516e6d83934200.patch";
      hash = "sha256-YjFh+mu5jyIJYUQFhmGqLXhec6lgQAdj4tWxij3NkwU=";
    })
  ];

  nativeBuildInputs = [
    cython
    setuptools
    setuptools-scm
  ];

  propagatedBuildInputs = [
    cloudpickle
    jinja2
    psutil
    pynvml
    rich
  ];

  __darwinAllowLocalNetworking = true;

  nativeCheckInputs = [
    pytestCheckHook
  ];

  checkInputs = [
    hypothesis
    numpy
  ];

  disabledTestPaths = [
    # remove on next update
    # Failing Darwin-specific tests that were subsequently removed from the source repo.
    "tests/test_coverup_35.py"
    "tests/test_coverup_42.py"
    "tests/test_coverup_43.py"
  ];

  # remove scalene directory to prevent pytest import confusion
  preCheck = ''
    rm -rf scalene
  '';

  pythonImportsCheck = [ "scalene" ];

  meta = with lib; {
    description = "High-resolution, low-overhead CPU, GPU, and memory profiler for Python with AI-powered optimization suggestions";
    homepage = "https://github.com/plasma-umass/scalene";
    changelog = "https://github.com/plasma-umass/scalene/releases/tag/v${version}";
    mainProgram = "scalene";
    license = licenses.asl20;
    maintainers = with maintainers; [ sarahec ];
  };
}