arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~

Python库中废弃API及其替代品的演化

Evolution of Deprecated APIs and Their Replacements in Python Libraries

Gangqiang He, Guanping Xiao

arXiv 2609.32618首次发表:更新:

发表机构

College of Computer Science and Technology, Nanjing University of Aeronautics and Astronautics; Key Laboratory for Safety-critical Software Development and Verification, Nanjing University of Aeronautics and Astronautics; State Key Laboratory for Novel Software Technology, Nanjing University(南京航空航天大学计算机科学与技术学院; 南京航空航天大学安全关键软件开发与验证重点实验室; 南京大学软件新技术国家重点实验室)

机构由 AI 辅助整理,请以论文原文为准。

AI 中文总结

本研究通过分析33个Python库的830个废弃API映射,揭示了替代关系受粒度、版本和生命周期影响,为演化感知的API迁移提供支持。

AI 中文摘要

背景:API废弃在库演化中很常见,但迁移需要找到替代品并调整调用。以往研究分别考察了废弃、替代品识别和客户端迁移,导致跨版本和生命周期状态下废弃API与替代API之间的关系理解不足。目标:我们从源定义和原始调用两个视角,考察替代品局部性、参数接口差异、替代品排名随版本的变化以及废弃后的生命周期。方法:我们从33个Python库构建了830个维护者指定的映射,涵盖类、函数和方法。我们比较定义,在两种迁移场景下跟踪基于相似度的排名,并通过源码检查和逐版本执行来识别生命周期事件。结果:同类模块中的替代品分别占类、函数和方法映射的39.1%、55.6%和79.9%。大多数映射没有参数变化,但函数映射显示出更频繁和多样的变化。排名随版本和代码表示而变化,适用方法在约60%的情况下对总体趋势达成一致。其他候选效应在49.0%的关键版本中占主导或混合。废弃后,56.4%的映射保留源定义,68.6%保留可执行的原始调用。在753个至少观察到一次结束事件的映射中,25.2%是源优先或调用优先而非同版本。这些案例中,77.4%是源优先。结论:废弃API与替代API的关系取决于API粒度、发布上下文、代码表示、候选竞争和生命周期状态。这些结果支持演化感知的替代API推荐和自动化API迁移。

英文摘要

Context: API deprecation is common in library evolution, but migration requires finding replacements and adapting calls. Prior studies examine deprecation, replacement identification, and client migration separately, leaving deprecated API-replacement API relationships across releases and lifecycle states insufficiently understood. Objective: We examine replacement locality, parameter-interface differences, changes in replacement rankings across versions, and post-deprecation lifecycles from source-definition and original-invocation perspectives. Method: We construct 830 maintainer-specified mappings from 33 Python libraries, covering classes, functions, and methods. We compare definitions, track similarity-based rankings under two migration scenarios, and identify lifecycle events through source inspection and release-by-release execution. Results: Same-module replacements account for 39.1%, 55.6%, and 79.9% of class, function, and method mappings, respectively. Most mappings have no parameter changes, but function mappings show more frequent and diverse changes. Rankings vary across releases and code representations, and the applicable methods agree on the overall trend in only about 60% of cases. Other-candidate effects are dominant or mixed in 49.0% of key versions. After deprecation, 56.4% of mappings retain the source definition and 68.6% retain an executable original invocation. Among 753 mappings with at least one observed ending event, 25.2% are source-first or invocation-first rather than same-release. Of these cases, 77.4% are source-first. Conclusions: Deprecated API-replacement API relationships depend on API granularity, release context, code representation, candidate competition, and lifecycle state. These results support evolution-aware replacement API recommendation and automated API migration.

Comments18 pages, 11 figures

论文原文

arXiv 摘要页 · PDF 原文 · HTML 原文

↑