From fe6547f77e6c31d251f663c087f86f1e47222fa9 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Thu, 29 Jan 2026 23:30:17 +0100 Subject: [PATCH] memray: move to pythonPackages --- pkgs/by-name/me/memray/package.nix | 86 +---------------- .../python-modules/memray/default.nix | 93 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 96 insertions(+), 85 deletions(-) create mode 100644 pkgs/development/python-modules/memray/default.nix diff --git a/pkgs/by-name/me/memray/package.nix b/pkgs/by-name/me/memray/package.nix index f8b11cd05f9e..710486be77fe 100644 --- a/pkgs/by-name/me/memray/package.nix +++ b/pkgs/by-name/me/memray/package.nix @@ -1,85 +1 @@ -{ - lib, - elfutils, - fetchFromGitHub, - libunwind, - lz4, - pkg-config, - python3Packages, -}: - -python3Packages.buildPythonApplication rec { - pname = "memray"; - version = "1.19.1"; - pyproject = true; - - src = fetchFromGitHub { - owner = "bloomberg"; - repo = "memray"; - tag = "v${version}"; - hash = "sha256-RdOtgNSkFIVl8Uve2iaJ7G0X1IHJ/Yo4h8hWP3pTV8g="; - }; - - build-system = with python3Packages; [ - distutils - setuptools - ]; - - nativeBuildInputs = [ pkg-config ]; - - buildInputs = [ - elfutils # for `-ldebuginfod` - libunwind - lz4 - ] - ++ (with python3Packages; [ cython ]); - - dependencies = with python3Packages; [ - pkgconfig - textual - jinja2 - rich - ]; - - nativeCheckInputs = - with python3Packages; - [ - ipython - pytest-cov-stub # fix Unknown pytest.mark.no_cover - pytest-textual-snapshot - pytestCheckHook - ] - ++ lib.optionals (pythonOlder "3.14") [ greenlet ]; - - pythonImportsCheck = [ "memray" ]; - - enabledTestPaths = [ "tests" ]; - - disabledTests = [ - # Import issue - "test_header_allocator" - "test_hybrid_stack_of_allocations_inside_ceval" - - # The following snapshot tests started failing since updating textual to 3.5.0 - "TestTUILooks" - "test_merge_threads" - "test_tui_basic" - "test_tui_gradient" - "test_tui_pause" - "test_unmerge_threads" - ]; - - disabledTestPaths = [ - # Very time-consuming and some tests fails (performance-related?) - "tests/integration/test_main.py" - ]; - - meta = { - description = "Memory profiler for Python"; - homepage = "https://bloomberg.github.io/memray/"; - changelog = "https://github.com/bloomberg/memray/releases/tag/${src.tag}"; - license = lib.licenses.asl20; - maintainers = with lib.maintainers; [ fab ]; - platforms = lib.platforms.linux; - }; -} +{ python3Packages }: with python3Packages; toPythonApplication memray diff --git a/pkgs/development/python-modules/memray/default.nix b/pkgs/development/python-modules/memray/default.nix new file mode 100644 index 000000000000..e857ca1cecf2 --- /dev/null +++ b/pkgs/development/python-modules/memray/default.nix @@ -0,0 +1,93 @@ +{ + lib, + buildPythonPackage, + cython, + distutils, + fetchFromGitHub, + greenlet, + ipython, + jinja2, + pkg-config, + pkgconfig, + pkgs, + pytest-cov-stub, + pytest-textual-snapshot, + pytestCheckHook, + pythonOlder, + rich, + setuptools, + textual, +}: + +buildPythonPackage rec { + pname = "memray"; + version = "1.19.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "bloomberg"; + repo = "memray"; + tag = "v${version}"; + hash = "sha256-RdOtgNSkFIVl8Uve2iaJ7G0X1IHJ/Yo4h8hWP3pTV8g="; + }; + + build-system = [ + distutils + setuptools + ]; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ + cython + pkgs.elfutils # for `-ldebuginfod` + pkgs.libunwind + pkgs.lz4 + ]; + + dependencies = [ + pkgconfig + textual + jinja2 + rich + ]; + + nativeCheckInputs = [ + ipython + pytest-cov-stub + pytest-textual-snapshot + pytestCheckHook + ] + ++ lib.optionals (pythonOlder "3.14") [ greenlet ]; + + pythonImportsCheck = [ "memray" ]; + + disabledTests = [ + # Import issue + "test_header_allocator" + "test_hybrid_stack_of_allocations_inside_ceval" + + # The following snapshot tests started failing since updating textual to 3.5.0 + "TestTUILooks" + "test_merge_threads" + "test_tui_basic" + "test_tui_gradient" + "test_tui_pause" + "test_unmerge_threads" + ]; + + disabledTestPaths = [ + # Very time-consuming and some tests fails (performance-related?) + "tests/integration/test_main.py" + ]; + + meta = { + description = "Memory profiler for Python"; + homepage = "https://bloomberg.github.io/memray/"; + changelog = "https://github.com/bloomberg/memray/releases/tag/${src.tag}"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ fab ]; + platforms = lib.platforms.linux; + mainProgram = "memray"; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index abd85a81e1d8..2520fe930e0b 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -9555,6 +9555,8 @@ self: super: with self; { memory-tempfile = callPackage ../development/python-modules/memory-tempfile { }; + memray = callPackage ../development/python-modules/memray { }; + meraki = callPackage ../development/python-modules/meraki { }; mercadopago = callPackage ../development/python-modules/mercadopago { };