1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 cython,
6 isPyPy,
7 ipython,
8 scikit-build,
9 cmake,
10 pythonOlder,
11 pytestCheckHook,
12 ubelt,
13}:
14
15buildPythonPackage rec {
16 pname = "line-profiler";
17 version = "4.1.3";
18 format = "setuptools";
19
20 disabled = pythonOlder "3.6" || isPyPy;
21
22 src = fetchPypi {
23 pname = "line_profiler";
24 inherit version;
25 hash = "sha256-5fESPDZywyGLoGPCO9ZKURWeRGSf7WeAuZPHgfte0xg=";
26 };
27
28 nativeBuildInputs = [
29 cython
30 cmake
31 scikit-build
32 ];
33
34 passthru.optional-dependencies = {
35 ipython = [ ipython ];
36 };
37
38 nativeCheckInputs = [
39 pytestCheckHook
40 ubelt
41 ] ++ passthru.optional-dependencies.ipython;
42
43 dontUseCmakeConfigure = true;
44
45 preBuild = ''
46 rm -f _line_profiler.c
47 '';
48
49 preCheck = ''
50 rm -r line_profiler
51 export PATH=$out/bin:$PATH
52 '';
53
54 pythonImportsCheck = [ "line_profiler" ];
55
56 meta = with lib; {
57 description = "Line-by-line profiler";
58 mainProgram = "kernprof";
59 homepage = "https://github.com/pyutils/line_profiler";
60 changelog = "https://github.com/pyutils/line_profiler/blob/v${version}/CHANGELOG.rst";
61 license = licenses.bsd3;
62 };
63}