一句话:提出 PyDFix,从构建日志中检测并自动修复导致 Python 构建不可复现的依赖错误。
开源依赖包被广泛复用,但其频繁更新常常破坏下游应用的构建;加之 Python 项目在依赖版本声明上缺乏统一规范,大型项目的历史构建会随时间变得不可复现。人工修复依赖错误代价高昂,自动化方法则需应对非结构化构建日志解析、传递依赖查找以及依赖版本组合的指数级搜索空间。本文首先实证考察开源 Python 项目如何声明依赖版本,以及依赖包对可复现性的影响,进而提出工具 PyDFix,用于检测并修复由依赖错误引起的构建不可复现问题。作者在来自真实开源项目的 BugSwarm 与 BugsInPy 两个缺陷数据集上进行评估,共分析 2,702 次构建,识别出 1,921 次(71.1%)因依赖错误而不可复现,其中 859 次(44.7%)被完整修复,另有 632 次(32.9%)获得部分修复。
Software reproducibility is important for re-usability and the cumulative progress of research. An important manifestation of unreproducible software is the changed outcome of software builds over time. While enhancing code reuse, the use of open-source dependency packages hosted on centralized repositories such as PyPI can have adverse effects on build reproducibility. Frequent updates to these packages often cause their latest versions to have breaking changes for applications using them. Large Python applications risk their historical builds becoming unreproducible due to the widespread usage of Python dependencies, and the lack of uniform practices for dependency version specification. Manually fixing dependency errors requires expensive developer time and effort, while automated approaches face challenges of parsing unstructured build logs, finding transitive dependencies, and exploring an exponential search space of dependency versions. In this paper, we investigate how open-source Python projects specify dependency versions, and how their reproducibility is impacted by dependency packages. We propose a tool PyDFix to detect and fix unreproducibility in Python builds caused by dependency errors. PyDFix is evaluated on two bug datasets BugSwarm and BugsInPy, both of which are built from real-world open-source projects. PyDFix analyzes a total of 2,702 builds, identifying 1,921 (71.1%) of them to be unreproducible due to dependency errors. From these, PyDFix provides a complete fix for 859 (44.7%) builds, and partial fixes for an additional 632 (32.9%) builds.