1{
2 lib,
3 buildPythonPackage,
4 hypothesis,
5 fetchpatch,
6 fetchPypi,
7 setuptools,
8 setuptools-scm,
9 cloudpickle,
10 cython,
11 jinja2,
12 numpy,
13 psutil,
14 pynvml,
15 pytestCheckHook,
16 pythonOlder,
17 rich,
18}:
19
20buildPythonPackage rec {
21 pname = "scalene";
22 version = "1.5.41";
23 pyproject = true;
24 disabled = pythonOlder "3.9";
25
26 src = fetchPypi {
27 inherit pname version;
28 hash = "sha256-akjxv9Qot2lGntZxkxfFqz65VboL1qduykfjyEg1Ivg=";
29 };
30
31 nativeBuildInputs = [
32 cython
33 setuptools
34 setuptools-scm
35 ];
36
37 propagatedBuildInputs = [
38 cloudpickle
39 jinja2
40 psutil
41 pynvml
42 rich
43 ];
44
45 __darwinAllowLocalNetworking = true;
46
47 nativeCheckInputs = [ pytestCheckHook ];
48
49 checkInputs = [
50 hypothesis
51 numpy
52 ];
53
54 # remove scalene directory to prevent pytest import confusion
55 preCheck = ''
56 rm -rf scalene
57 '';
58
59 pythonImportsCheck = [ "scalene" ];
60
61 meta = with lib; {
62 description = "High-resolution, low-overhead CPU, GPU, and memory profiler for Python with AI-powered optimization suggestions";
63 homepage = "https://github.com/plasma-umass/scalene";
64 changelog = "https://github.com/plasma-umass/scalene/releases/tag/v${version}";
65 mainProgram = "scalene";
66 license = licenses.asl20;
67 maintainers = with maintainers; [ sarahec ];
68 };
69}