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 = "5.0.0";
18 format = "setuptools";
19
20 disabled = pythonOlder "3.8" || isPyPy;
21
22 src = fetchPypi {
23 pname = "line_profiler";
24 inherit version;
25 hash = "sha256-qA8K+wW6DSddnd3F/5fqtjdHEWf/Pmbcx9E1dVBZOYw=";
26 };
27
28 nativeBuildInputs = [
29 cython
30 cmake
31 scikit-build
32 ];
33
34 optional-dependencies = {
35 ipython = [ ipython ];
36 };
37
38 nativeCheckInputs = [
39 pytestCheckHook
40 ubelt
41 ]
42 ++ optional-dependencies.ipython;
43
44 dontUseCmakeConfigure = true;
45
46 preBuild = ''
47 rm -f _line_profiler.c
48 '';
49
50 preCheck = ''
51 rm -r line_profiler
52 export PATH=$out/bin:$PATH
53 '';
54
55 pythonImportsCheck = [ "line_profiler" ];
56
57 meta = with lib; {
58 description = "Line-by-line profiler";
59 mainProgram = "kernprof";
60 homepage = "https://github.com/pyutils/line_profiler";
61 changelog = "https://github.com/pyutils/line_profiler/blob/v${version}/CHANGELOG.rst";
62 license = licenses.bsd3;
63 };
64}