python依赖+部署工具?

时间:2011-05-23 01:48:12

标签: python deployment dependencies dependency-management web-deployment

有人知道在Python中处理模块依赖性+部署的工具吗?

详细说明: 通过处理,我的意思是:

  • list,
  • 跟踪和
  • 为我捆绑一个zip /可安装文件。
  • 在另一个系统上重新部署(即:在部署文件中包含正确版本的所有模块,而不必去某个地方获取它们)。
  • 如果我要做一些改变环境的事情,请提醒我。
  • 它必须始终遵循模块依赖关系,而不仅仅是一个层次。
  • 加上一些我可能没有想过的东西。

  • 我不是在谈论Virtualenv,Fabric,pip freeze **和(我不认为)Paver。

今晚我试图计算Pylons所依赖的模块。在绕过Snakefood和Graphviz之后,答案是很多。 100+(和Snakefood没有得到它们)。

随着我越来越多地使用Python,手动处理这个问题开始占用我的时间比我想要的更多,并且它是不可靠的。

如果重要,我在Windows 7上使用Python 2.7。

* I know this will introduce some artifacts.  
** Combining virtualenv and pip freeze goes some way to solving this, but it's still not what I am looking for. 

2 个答案:

答案 0 :(得分:5)

Setuptoolspypi就是为此而做的。 setuptools是一个增强的distutils,您可以使用它来指定依赖项。例如,在设置功能中:

install_requires = ['simplejson>=2.0,==dev'],

使用easy_install时会引入该依赖关系。

答案 1 :(得分:2)

由于您在Windows上,请查看py2exe。 感兴趣的是py2exe FAQ

How does py2exe decide which modules you need?
To determine which modules should go in the final .exe file, py2exe 
does a recursive search of the script that you are packaging to find 
its dependencies and, in turn, all of their dependencies.