基于静态分析的Python第三方库API兼容性问题检测方法
作者:
作者单位:

作者简介:

通讯作者:

中图分类号:

TP311

基金项目:

国家自然科学基金(62372114); 中国博士后科学基金(2022M720768)


Detecting Incompatible Third-party Library APIs in Python Based on Static Analysis
Author:
Affiliation:

Fund Project:

  • 摘要
  • |
  • 图/表
  • |
  • 访问统计
  • |
  • 参考文献
  • |
  • 相似文献
  • |
  • 引证文献
  • |
  • 资源附件
  • |
  • 文章评论
    摘要:

    Python丰富的开发生态提供了多种多样的第三方库, 极大地提高了开发者的开发效率和质量. 第三方库开发者通过对代码底层的封装, 使得上层应用开发者只需调用API就可以使用相关功能, 从而快速完成开发任务. 然而, 第三方库API不会保持恒定不变. 由于缺陷修复、代码重构、功能新增等, 第三方库代码会不断更新. 更新后部分API发生了不兼容的更改, 从而导致上层应用运行异常终止或者产生不一致的结果. 因此, Python第三方库API的兼容性问题已成为目前开源生态中亟需解决的问题之一. 目前已有相关研究工作对Python第三方库API兼容性问题展开研究, 但兼容性问题原因的分类覆盖不够完全, 无法输出兼容性问题的细粒度原因. 为此, 本文对Python第三方库API兼容性问题的表现形式和产生原因开展了实证研究, 并针对性提出了Python不兼容API的静态检测方法. 首先, 本文针对flask库和pandas库的总共6个版本对, 通过收集版本更新日志、运行回归测试相结合的方法, 共收集108个不兼容API对. 接着, 本文对收集到的数据开展实证研究, 总结了Python第三方库API兼容性问题的表现形式和产生原因. 最后, 本文提出了一种基于静态分析技术的Python不兼容API的检测方法, 输出句法层面的不兼容API问题产生原因. 本文在4个常用Python第三方库的共计12个版本对上进行了实验评估, 结果表明本文方法具有良好的有效性、泛化性、时间性能、空间性能、以及易用性.

    Abstract:

    The rich development ecosystem of Python provides a lot of third-party libraries, significantly boosting developers' efficiency and quality. Third-party library developers encapsulate underlying code, enabling upper-layer application developers to swiftly accomplish tasks by calling relevant APIs. However, APIs of third-party libraries are not constant. Owing to fixes, refactoring, and feature additions, these libraries undergo continuous updates. Incompatible changes are seen in some APIs after updates, leading to abnormal termination or inconsistent results in upper-layer applications. Therefore, the API compatibility of the Python third-party library has become one of the issues that needs to be solved. There have been related studies focusing on API compatibility issues of Python third-party libraries, of which reasons have yet to be fully classified so that, the fine-grained cause can not be provided. An empirical study is conducted on the symptoms and causes of API compatibility issues with Python third-party library and a targeted static detection method is proposed. Initially, this study gathers 108 pairs of incompatible API versions by combining version update logs and regression tests across 6 version pairs of the Flask and Pandas libraries. Subsequently, an empirical study is conducted on the collected data, summarizing the symptoms and causes of compatibility issues. Finally, this study proposes a static analysis-based detection method for incompatible Python APIs, providing syntactic-level causes of incompatible API issues. This study conducts experimental evaluations on 12 version pairs of 4 popular Python third-party libraries. The results show that the proposed method is good in effectiveness, generalization, time performance, memory performance, and usefulness.

    参考文献
    相似文献
    引证文献
引用本文

沈阚,黄凯锋,陈碧欢,彭鑫.基于静态分析的Python第三方库API兼容性问题检测方法.软件学报,,():1-26

复制
分享
文章指标
  • 点击次数:
  • 下载次数:
  • HTML阅读次数:
  • 引用次数:
历史
  • 收稿日期:2023-12-18
  • 最后修改日期:2024-03-20
  • 录用日期:
  • 在线发布日期: 2024-07-03
  • 出版日期:
您是第位访问者
版权所有:中国科学院软件研究所 京ICP备05046678号-3
地址:北京市海淀区中关村南四街4号,邮政编码:100190
电话:010-62562563 传真:010-62562533 Email:jos@iscas.ac.cn
技术支持:北京勤云科技发展有限公司

京公网安备 11040202500063号