paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Conflict-aware inference of python compatible runtime environments with domain knowledge graph

基于领域知识图谱的冲突感知 Python 兼容运行时环境推断
ICSE Proceedings of the 44th International Conference on Software Engineering2022匹配度 3/10 · 该论文属于软件工程/开发者工具方向,核心是基于知识图谱与启发式依赖求解推断 Python 运行时环境;虽然涉及对代码导入依赖的分析,但并非用户关注的 PL↔AI、静态分析用于 ML/Agentic 程序、LLM/Agent 改进程序分析、浮点或贝叶斯程序分析等主题。引用 18 inbox
Wei Cheng, Xiangrong Zhu, Wei Hu
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出 PyCRE,利用领域知识图谱与冲突感知启发式依赖求解,自动推断 Python 兼容运行时环境。

开源 Python 代码数量庞大,但恢复可成功运行的运行时环境仍然困难。已有基于预构建知识库的依赖推断工作覆盖知识不足,且忽略推断依赖之间的潜在冲突,导致推断成功率偏低。本文提出 PyCRE:为 Python 第三方包设计领域本体,并为 Python 2 和 Python 3 中超过一万个热门包构建知识图谱;通过度量已知库与目标代码所用第三方资源的匹配程度来发现候选库;针对 NP 完全的依赖求解问题,提出启发式图遍历算法,以高效保证包与包之间的兼容性。在真实数据集上,PyCRE 取得优于先前方法的性能,并能多解决近一半的 import 错误。

问题
如何从 Python 代码准确推断出兼容的运行时依赖环境,并在依赖求解过程中避免包之间的冲突。
方法
构建 Python 第三方包领域本体与知识图谱,基于匹配度发现候选库,并用启发式图遍历算法求解依赖兼容性。
评估
在真实数据集上与先前方法比较,PyCRE 能更高效地解决 import 错误,且多解决近一半的错误。
原文摘要(Abstract)

Code sharing and reuse is a widespread use practice in software engineering. Although a vast amount of open-source Python code is accessible on many online platforms, programmers often find it difficult to restore a successful runtime environment. Previous studies validated automatic inference of Python dependencies using pre-built knowledge bases. However, these studies do not cover sufficient knowledge to accurately match the Python code and also ignore the potential conflicts between their inferred dependencies, thus resulting in a low success rate of inference. In this paper, we propose PyCRE, a new approach to automatically inferring Python compatible runtime environments with domain knowledge graph (KG). Specifically, we design a domain-specific ontology for Python third-party packages and construct KGs for over 10,000 popular packages in Python 2 and Python 3. PyCRE discovers candidate libraries by measuring the matching degree between the known libraries and the third-party resources used in target code. For the NP-complete problem of dependency solving, we propose a heuristic graph traversal algorithm to efficiently guarantee the compatibility between packages. PyCRE achieves superior performance on a real-world dataset and efficiently resolves nearly half more import errors than previous methods.

链接与引用

DOI 原文 · arXiv · PDF(开放获取) · DBLP

BibTeX
@inproceedings{ChengZH22,
  title = {Conflict-aware inference of python compatible runtime environments with domain knowledge graph},
  author = {Wei Cheng and Xiangrong Zhu and Wei Hu},
  booktitle = {ICSE},
  year = {2022},
  doi = {10.1145/3510003.3510078}
}