at 25.11-pre 1.9 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 7 # build-system 8 setuptools, 9 10 # dependencies 11 astor, 12 dill, 13 filelock, 14 15 # tests 16 pytestCheckHook, 17 torch, 18 pythonAtLeast, 19}: 20 21buildPythonPackage rec { 22 pname = "depyf"; 23 version = "0.19.0"; 24 pyproject = true; 25 26 src = fetchFromGitHub { 27 owner = "thuml"; 28 repo = "depyf"; 29 tag = "v${version}"; 30 hash = "sha256-AGM5Pm0hhqOX9CY7dFijZLqhWmY7xnmKWakh4MUtOMs="; 31 }; 32 33 # don't try to read git commit 34 postPatch = '' 35 substituteInPlace setup.py \ 36 --replace-fail 'commit_id = get_git_commit_id()' 'commit_id = None' 37 ''; 38 39 build-system = [ 40 setuptools 41 ]; 42 43 dependencies = [ 44 astor 45 dill 46 filelock 47 ]; 48 49 nativeCheckInputs = [ 50 pytestCheckHook 51 torch 52 ]; 53 54 disabledTestPaths = 55 [ 56 # if self.quitting: raise BdbQuit 57 # E bdb.BdbQuit 58 "tests/test_pytorch/test_pytorch.py" 59 ] 60 ++ lib.optionals (pythonAtLeast "3.13") [ 61 62 # depyf.decompiler.DecompilationError: DecompilationError: Failed to decompile instruction ... 63 # NotImplementedError: Unsupported instruction: LOAD_FAST_LOAD_FAST 64 "tests/test_code_owner.py" 65 ] 66 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 67 # E torch._dynamo.exc.BackendCompilerFailed: backend='inductor' raised: 68 # E CppCompileError: C++ compile error 69 "tests/test_pytorch/test_export.py" 70 "tests/test_pytorch/test_logging.py" 71 "tests/test_pytorch/test_simple_graph.py" 72 ]; 73 74 # All remaining tests fail with: 75 # ValueError: invalid literal for int() with base 10: 'L1' 76 doCheck = !(pythonAtLeast "3.13"); 77 78 pythonImportsCheck = [ "depyf" ]; 79 80 meta = { 81 description = "Decompile python functions, from bytecode to source code"; 82 homepage = "https://github.com/thuml/depyf"; 83 changelog = "https://github.com/thuml/depyf/releases/tag/v${version}"; 84 license = lib.licenses.mit; 85 }; 86}