DockerizeMe: Automatic Inference of Environment Dependencies for Python Code Snippets

DockerizeMe: Automatic Inference of Environment Dependencies for Python Code Snippets
复制标题

DOI:
10.1109/icse.2019.00047
复制
发表时间:
2019-05
期刊:
2019 IEEE/ACM 41st International Conference on Software Engineering (ICSE)
影响因子:
--
通讯作者:
Eric Horton;Chris Parnin
Eric Horton;Chris Parnin
中科院分区:
其他
文献类型:
--
作者:
Eric Horton;Chris Parnin

文献摘要

相似文献

Stack Overflow和GitHub的gist系统等平台通过分发旨在说明特定任务的代码片段来促进思想和编程技术的共享。Python是一种流行且快速发展的编程语言,在这两个网站上都有大量使用,Stack Overflow上有近100万个问题,GitHub上有40万名公众。不幸的是,通过这些站点共享的大约75%的Python示例代码不能直接执行。当在干净的环境中运行时,由于缺少库的导入错误,超过50%的公共Python列表会失败。我们介绍DockerizeMe,这是一种推断执行Python代码段所需的依赖项而不出现导入错误的技术。DockerizeMe首先从Python包索引(PyPI)中获取流行Python包的资源和依赖项的离线知识。然后,它使用基于图的推理过程构建Docker规范。我们的推理过程解决了来自Gistable数据集的近3000个gist中的892个的导入错误,其中Gistable的基线方法无法找到并安装所有依赖项。
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.