跳到主要导航 跳到搜索 跳到主要内容

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
  • Xi'an Jiaotong University
  • Huawei Technologies Co., Ltd.

科研成果: 书/报告/会议事项章节 › 会议稿件 › 同行评审

2 引用 (Scopus)

摘要

Dependency extraction based on static analysis lays the ground-work for a wide range of applications. However, dynamic language features in Python make code behaviors obscure and nondeter-ministic; 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 pre-cision. Moreover, PyAnalyzer leverages optional type annotations as a shortcut to express varying call sites and resolve library depen-dencies 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.

源语言英语
主期刊名Proceedings - 2024 ACM/IEEE 44th International Conference on Software Engineering, ICSE 2024
出版商IEEE Computer Society
页1372-1383
页数12
ISBN(电子版)9798400702174
DOI
出版状态已出版 - 20 5月 2024
活动44th ACM/IEEE International Conference on Software Engineering, ICSE 2024 - Lisbon, 葡萄牙
期限: 14 4月 2024 → 20 4月 2024

丛书

姓名Proceedings - International Conference on Software Engineering
ISSN(印刷版)0270-5257

会议

会议44th ACM/IEEE International Conference on Software Engineering, ICSE 2024
国家/地区葡萄牙
市Lisbon
时期14/04/24 → 20/04/24

学术指纹

探究 'PyAnalyzer: An Effective and Practical Approach for Dependency Extraction from Python Code' 的科研主题。它们共同构成独一无二的学术指纹。

引用此