Characterizing and detecting Python version incompatibilities caused by inconsistent version specifications - Li, Shuo; Gao, Haocheng; Chen, Wei; Li, Yi; Tian, Haoxiang; Liu, Chengwei; Ye, Dan (The Journal of systems and software, 2025)
Python interpreter serves as the foundation for developing Python projects. Configuring compatible Python version is essential for packaging and reusing third-party libraries (TPLs) in the Python ecosystem. When the Python distribution version range constraint of a third-party library is incorrectly declared, it may lead to installation failures or runtime errors when the library is used by a client project. We call such errors Python Distribution Version Specification Error (PDSpecErr). PDSpecErrs are not studied adequately and there still lacks a method to guarantee the correctness of Python version specifications. To combat PDSpecErrs and mitigate their adverse impacts on downstream applications, we conducted the first exploratory study on 3000 real-world TPLs to investigate PDSpecErrs about their prevalence, symptom categories, and diagnostic patterns. Based on the comprehensive study, we designed and implemented PyChecker, a tool to automatically detect PDSpecErrs in TPLs, locate root causes, and generate fixing solutions. We evaluated PyChecker on 3000 TPL releases and PyChecker detected 842 PDSpecErrs, reporting their root causes and recommending fixing solutions. We have reported 52 PDSpecErrs to the concerned developers. So far, 32 issues have been confirmed and fixed according to our suggestions. •We conducted the first study on Python distribution version errors in top 3,000 TPLs.•Around 10% of TPLs had errors, causing installation failures and runtime issues.•We developed PyChecker to detect errors, find root causes, and suggest fixes.•PyChecker found 842 TPLs with errors; 61.5% of reported cases were fixed.•We provide PyChecker and evaluation data for replication and further research.