arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2207.01124cs.SE
收藏

Python库迁移的特征刻画

Characterizing Python Library Migrations

Mohayeminul Islam, Ajay Kumar Jha, Ildar Akhmetov, Sarah Nadi

AI总结:

本研究通过人工标注335次Python库迁移的3096处代码变更,构建迁移代码变更分类体系PyMigTax,揭示Python库迁移的多维度特征及现有迁移工具的不足。

摘要:

开发者严重依赖库提供的应用程序编程接口(API)来构建软件。随着软件演进,开发者可能需要将所用库替换为替代库,这一过程称为库迁移。手动执行库迁移繁琐、耗时且容易出错。自动化迁移技术可帮助减轻部分负担,但设计有效的自动化迁移技术需要明确将使用旧库的客户端代码转换为使用新库的代码所需的代码变更类型。本文通过实证研究全面呈现Python库迁移的特征,涵盖迁移所需的代码变更及相关的典型开发工作量两方面。我们对来自35个领域的141个库对、涉及311个客户端仓库的335次Python库迁移中的3096处迁移相关代码变更进行了人工标注。基于标注数据,我们构建了用于描述迁移相关代码变更的分类体系PyMigTax。借助PyMigTax和标注数据,我们探究了Python库迁移的多项特征,例如程序元素类型与API映射属性、单次迁移中各类迁移相关代码变更的组合情况,以及迁移所需的典型开发工作量。研究发现揭示了当前库迁移工具的多项潜在不足:例如,40%的库对存在涉及非函数程序元素的API映射,而大多数库迁移技术通常假设源库的函数调用会映射为目标库的(一个或多个)函数调用。作为迁移开发工作量的近似衡量,我们发现开发者平均需要学习约4个API和2种API映射才能完成一次迁移。

英文摘要:

Developers heavily rely on Application Programming Interfaces (APIs) from libraries to build their software. As software evolves, developers may need to replace the used libraries with alternate libraries, a process known as library migration. Doing this manually can be tedious, time-consuming, and prone to errors. Automated migration techniques can help alleviate some of this burden. However, designing effective automated migration techniques requires understanding the types of code changes required to transform client code that used the old library to the new library. This paper contributes an empirical study that provides a holistic view of Python library migrations, both in terms of the code changes required in a migration and the typical development effort involved. We manually label 3,096 migration-related code changes in 335 Python library migrations from 311 client repositories spanning 141 library pairs from 35 domains. Based on our labeled data, we derive a taxonomy for describing migration-related code changes, PyMigTax. Leveraging PyMigTax and our labeled data, we investigate various characteristics of Python library migrations, such as the types of program elements and properties of API mappings, the combinations of types of migration-related code changes in a migration, and the typical development effort required for a migration. Our findings highlight various potential shortcomings of current library migration tools. For example, we find that 40% of library pairs have API mappings that involve non-function program elements, while most library migration techniques typically assume that function calls from the source library will map into (one or more) function calls from the target library. As an approximation for the development effort involved, we find that, on average, a developer needs to learn about 4 APIs and 2 API mappings to perform a migration, and ... (truncated)

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑