1{ lib, stdenv 2, bottle 3, buildPythonPackage 4, fetchpatch 5, fetchPypi 6, pytestCheckHook 7, pythonAtLeast 8}: 9 10buildPythonPackage rec { 11 pname = "Pympler"; 12 version = "1.0.1"; 13 14 src = fetchPypi { 15 inherit pname version; 16 sha256 = "993f1a3599ca3f4fcd7160c7545ad06310c9e12f70174ae7ae8d4e25f6c5d3fa"; 17 }; 18 19 patches = [ 20 # Fixes a TypeError on Python 3.11 21 # (see https://github.com/pympler/pympler/issues/148) 22 # https://github.com/pympler/pympler/pull/149 23 (fetchpatch { 24 name = "${pname}-python-3.11-compat.patch"; 25 url = "https://github.com/pympler/pympler/commit/0fd8ad8da39207bd0dcb28bdac0407e04744c965.patch"; 26 hash = "sha256-6MK0AuhVhQkUzlk29HUh1+mSbfsVTBJ1YBtYNIFhh7U="; 27 }) 28 ]; 29 30 nativeCheckInputs = [ 31 pytestCheckHook 32 ]; 33 34 # There is a version of bottle bundled with Pympler, but it is broken on 35 # Python 3.11. Fortunately, Pympler will preferentially import an external 36 # bottle if it is available, so we make it an explicit dependency. 37 propagatedBuildInputs = [ 38 bottle 39 ]; 40 41 disabledTests = [ 42 # 'AssertionError: 'function (test.muppy.test_summary.func)' != 'function (muppy.test_summary.func)' 43 # https://github.com/pympler/pympler/issues/134 44 "test_repr_function" 45 ] ++ lib.optionals (pythonAtLeast "3.11") [ 46 # https://github.com/pympler/pympler/issues/148 47 "test_findgarbage" 48 "test_get_tree" 49 "test_prune" 50 ]; 51 52 doCheck = stdenv.hostPlatform.isLinux; 53 54 meta = with lib; { 55 description = "Tool to measure, monitor and analyze memory behavior"; 56 homepage = "https://pythonhosted.org/Pympler/"; 57 license = licenses.asl20; 58 }; 59 60}