paperbot · PL 论文追踪

全部论文 待读 收藏

P2 DockerizeMe: Automatic Inference of Environment Dependencies for Python Code Snippets

DockerizeMe:自动推断 Python 代码片段的环境依赖
ICSE 2019 IEEE/ACM 41st International Conference on Software Engineering (ICSE)2019匹配度 3/10 · 论文属于程序分析与开发者工具,目标是推断 Python 代码片段的依赖并生成 Docker 配置,与用户关注的静态分析/Agentic 程序、LLM 改进静态分析、浮点程序分析或贝叶斯程序分析均无直接交叉。虽然其依赖推断与代码片段可执行化可能间接服务于 Coding Agent 环境构建,但论文本身不涉及 LLM/Agent,也不是针对上述核心问题的研究。引用 72 inbox
Eric Horton, Chris Parnin
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:DockerizeMe 通过 PyPI 离线知识与图推断自动补全 Python 代码片段依赖并生成 Docker 配置。

Stack Overflow、GitHub gist 等平台大量分享 Python 代码片段,但约 75% 无法直接执行,超过 50% 的公开 gist 在干净环境中因缺少库的 import 错误而失败。为此,作者提出 DockerizeMe,一种为 Python 代码片段推断执行所需依赖的技术。该方法首先从 Python Package Index(PyPI)离线获取流行包的资源与依赖知识,然后通过基于图的推断过程构建 Docker 规范,以解析代码中的导入并补全依赖。在 Gistable 数据集近 3000 个 gist 上评估,对于 Gistable 基线方法无法找到并安装全部依赖的样本,DockerizeMe 成功修复了其中 892 个的 import 错误。

问题
如何自动推断执行 Python 代码片段所需的库与环境依赖,从而避免在干净环境中因 import 错误而无法运行。
方法
先从 PyPI 离线获取流行 Python 包的资源与依赖知识,再用基于图的推断过程生成可满足代码片段导入需求的 Docker 规范。
评估
在 Gistable 数据集的近 3000 个 gist 上评估;针对基线方法无法找到并安装全部依赖的样本,DockerizeMe 修复了 892 个 gist 的 import 错误。
原文摘要(Abstract)

Platforms like Stack Overflow and GitHub's gist system promote the sharing of ideas and programming techniques via the distribution of code snippets designed to illustrate particular tasks. Python, a popular and fast-growing programming language, sees heavy use on both sites, with nearly one million questions asked on Stack Overflow and 400 thousand public gists on GitHub. Unfortunately, around 75% of the Python example code shared through these sites cannot be directly executed. When run in a clean environment, over 50% of public Python gists fail due to an import error for a missing library. We present DockerizeMe, a technique for inferring the dependencies needed to execute a Python code snippet without import error. DockerizeMe starts with offline knowledge acquisition of the resources and dependencies for popular Python packages from the Python Package Index (PyPI). It then builds Docker specifications using a graph-based inference procedure. Our inference procedure resolves import errors in 892 out of nearly 3,000 gists from the Gistable dataset for which Gistable's baseline approach could not find and install all dependencies.

链接与引用

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

BibTeX
@inproceedings{HortonP19,
  title = {DockerizeMe: Automatic Inference of Environment Dependencies for Python Code Snippets},
  author = {Eric Horton and Chris Parnin},
  booktitle = {ICSE},
  year = {2019},
  doi = {10.1109/icse.2019.00047}
}