btrbk: add mainProgram
[NixPkgs.git] / pkgs / by-name / me / memray / package.nix
blobcfe12b41d3aa7ff4d46f284654c3733021ac29cd
2   lib,
3   elfutils,
4   fetchFromGitHub,
5   libunwind,
6   lz4,
7   pkg-config,
8   python3Packages,
9 }:
11 python3Packages.buildPythonApplication rec {
12   pname = "memray";
13   version = "1.14.0";
14   pyproject = true;
16   src = fetchFromGitHub {
17     owner = "bloomberg";
18     repo = "memray";
19     rev = "refs/tags/v${version}";
20     hash = "sha256-U9JR60rSxPYXbZaKR7vVNhGT78AXnqcoqvVC6/1OW/E=";
21   };
23   build-system = with python3Packages; [
24     distutils
25     setuptools
26   ];
28   nativeBuildInputs = [ pkg-config ];
30   buildInputs = [
31     libunwind
32     lz4
33     elfutils # for `-ldebuginfod`
34   ] ++ (with python3Packages; [ cython ]);
36   dependencies = with python3Packages; [
37     pkgconfig
38     textual
39     jinja2
40     rich
41   ];
43   nativeCheckInputs =
44     with python3Packages;
45     [
46       ipython
47       pytest-cov # fix Unknown pytest.mark.no_cover
48       pytest-textual-snapshot
49       pytestCheckHook
50     ]
51     ++ lib.optionals (pythonOlder "3.12") [ greenlet ];
53   pythonImportsCheck = [ "memray" ];
55   pytestFlagsArray = [ "tests" ];
57   disabledTests = [
58     # Import issue
59     "test_header_allocator"
60     "test_hybrid_stack_of_allocations_inside_ceval"
62     # snapshot-based tests are too fragile
63     # see https://github.com/bloomberg/memray/issues/654
64     "TestTUILooks"
65     "test_tui_basic"
66     "test_tui_pause"
67     "test_tui_gradient"
68     "test_merge_threads"
69     "test_unmerge_threads"
70   ];
72   disabledTestPaths = [
73     # Very time-consuming and some tests fails (performance-related?)
74     "tests/integration/test_main.py"
75   ];
77   meta = with lib; {
78     description = "Memory profiler for Python";
79     homepage = "https://bloomberg.github.io/memray/";
80     changelog = "https://github.com/bloomberg/memray/releases/tag/v${version}";
81     license = licenses.asl20;
82     maintainers = with maintainers; [ fab ];
83     platforms = platforms.linux;
84   };