PyAnalyzer: An Effective and Practical Approach for Dependency Extraction from Python Code
Wuxia Jin, Shuo Xu, Dawei Chen, Jiajun He, Dinghong Zhong, Ming Fan, Hongxu Chen, Huijia Zhang, Ting Liu
摘要
Dependency extraction based on static analysis lays the groundwork for a wide range of applications. However, dynamic language features in Python make code behaviors obscure and nondeterministic; consequently, it poses huge challenges for static analyses to resolve symbol-level dependencies. Although prosperous techniques and tools are adequately available, they still lack sufficient capabilities to handle object changes, first-class citizens, varying call sites, and library dependencies. To address the fundamental difficulty for dynamic languages, this work proposes an effective and practical method namely PyAnalyzer for dependency extraction. PyAnalyzer uniformly models functions, classes, and modules into first-class heap objects, propagating the dynamic changes of these objects and class inheritance. This manner better simulates dynamic features like duck typing, object changes, and first-class citizens, resulting in high recall results without compromising precision. Moreover, PyAnalyzer leverages optional type annotations as a shortcut to express varying call sites and resolve library dependencies on demand. We collected two micro-benchmarks (278 small programs), two macro-benchmarks (59 real-world applications), and 191 real-world projects (10MSLOC) for comprehensive comparisons with 7 advanced techniques (i.e., Understand, Sourcetrail, Depends, ENRE19, PySonar2, PyCG, and Type4Py). The results demonstrated that PyAnalyzer achieves a high recall and hence improves the F1 by 24.7% on average, at least 1.4x faster without an obvious compromise of memory efficiency. Our work will benefit diverse client applications.
问问这篇 Paper
问问你的智能体。
Lune 读过与它相关的顶会 Paper,每个回答都会注明依据哪几篇。
引用它的顶会 Paper3
- AutoCodeRover: Autonomous Program ImprovementYuntong Zhang, Haifeng Ruan, Zhiyu Fan, Abhik RoychoudhuryISSTA 2024 · 被引用 96 次
- Co-evolution of Types and Dependencies: Towards Repository-Level Type Inference for Python CodeShuo Sun, Shixin Zhang, Jiwei Yan, Jun Yan 等FSE 2026
- Beyond Final Code: A Process-Oriented Error Analysis of Software Development Agents in Real-World GitHub ScenariosZhi Chen, Wei Ma, Lingxiao JiangICSE 2026
相关 Paper
- PyCG: Practical Call Graph Generation in PythonVitalis Salis, Thodoris Sotiropoulos, Panos Louridas, Diomidis Spinellis 等ICSE 2021
- Exploring the Architectural Impact of Possible Dependencies in Python SoftwareWuxia Jin, Yuanfang Cai, Rick Kazman, Gang Zhang 等ASE 2020 · 被引用 13 次
- DyPyBench: A Benchmark of Executable Python SoftwareIslem Bouzenia, Bajaj Piyush Krishan, Michael PradelFSE 2024 · 被引用 8 次
- DLInfer: Deep Learning with Static Slicing for Python Type InferenceYanyan Yan, Yang Feng, Hongcheng Fan, Baowen XuICSE 2023 · 被引用 9 次
- QuAC: Quick Attribute-Centric Type Inference for PythonJifeng Wu, Caroline LemieuxOOPSLA 2024 · 被引用 2 次
