PCART: Automated Repair of Python API Parameter Compatibility Issues

📅 2024-06-06
🏛️ arXiv.org
📈 Citations: 2
Influential: 0
📄 PDF
🤖 AI Summary
Python third-party library API parameter evolution frequently causes client-side compatibility issues, yet existing tools lack automated detection and repair capabilities. This paper introduces PyFix, the first end-to-end automated framework for API compatibility management, encompassing API extraction, instrumentation, semantic mapping, compatibility assessment, patch generation, and validation. We formally model five categories of parameter changes—addition, removal, modification, reordering, and positional-to-keyword conversion—and design a rule-driven repair engine coupled with a multi-dimensional verification mechanism. Furthermore, we construct PCBENCH, the first large-scale benchmark comprising 47,478 real-world test cases. Experimental results show that PyFix achieves an F1-score of 96.49% for compatibility detection and a repair accuracy of 92.26%, significantly outperforming state-of-the-art approaches including MLCatchUp, Relancer, and GPT-4o. Its effectiveness and practicality are further validated on 30 real-world GitHub projects.

Technology Category

Application Category

📝 Abstract
In modern software development, Python third-party libraries play a critical role, especially in fields like deep learning and scientific computing. However, API parameters in these libraries often change during evolution, leading to compatibility issues for client applications reliant on specific versions. Python's flexible parameter-passing mechanism further complicates this, as different passing methods can result in different API compatibility. Currently, no tool can automatically detect and repair Python API parameter compatibility issues. To fill this gap, we introduce PCART, the first solution to fully automate the process of API extraction, code instrumentation, API mapping establishment, compatibility assessment, repair, and validation. PCART handles various types of Python API parameter compatibility issues, including parameter addition, removal, renaming, reordering, and the conversion of positional to keyword parameters. To evaluate PCART, we construct PCBENCH, a large-scale benchmark comprising 47,478 test cases mutated from 844 parameter-changed APIs across 33 popular Python libraries. Evaluation results demonstrate that PCART is both effective and efficient, significantly outperforming existing tools (MLCatchUp and Relancer) and the large language model ChatGPT (GPT-4o), achieving an F1-score of 96.49% in detecting API parameter compatibility issues and a repair precision of 92.26%. Further evaluation on 30 real-world Python projects from GitHub confirms PCART's practicality. We believe PCART can significantly reduce the time programmers spend maintaining Python API updates and advance the automation of Python API compatibility issue repair.
Problem

Research questions and friction points this paper is trying to address.

Automated detection and repair of Python API parameter compatibility issues.
Handles parameter changes like addition, removal, renaming, and reordering.
Improves efficiency and precision in maintaining Python API updates.
Innovation

Methods, ideas, or system contributions that make the work stand out.

Automates Python API parameter compatibility repair
Handles parameter addition, removal, renaming, reordering
Achieves high F1-score and repair precision
🔎 Similar Papers
No similar papers found.
S
Shuai Zhang
College of Computer Science and Technology, Nanjing University of Aeronautics and Astronautics, Nanjing, China
Guanping Xiao
Guanping Xiao
Associate Professor, Nanjing University of Aeronautics and Astronautics
Software ReliabilitySoftware AnalysisProgram AnalysisSoftware Evolution
J
Jun Wang
College of Computer Science and Technology, Nanjing University of Aeronautics and Astronautics, Nanjing, China
H
Huashan Lei
College of Computer Science and Technology, Nanjing University of Aeronautics and Astronautics, Nanjing, China
Yepang Liu
Yepang Liu
Associate Professor, CSE, Southern University of Science and Technology
Software testing and analysisempirical software engineeringsoftware securitycyber-physical
Z
Zheng Zheng
School of Automation Science and Electrical Engineering, Beihang University, Beijing, China