Python 中可重现环境的工具(或工具组合)
我曾经是一名java开发人员,我们使用ant或maven等工具以标准化的方式管理我们的开发/测试/UAT环境。 这使我们能够处理库依赖性、设置操作系统变量、编译、部署、运行单元测试以及所有必需的任务。 此外,生成的脚本保证了所有环境几乎均等配置,并且所有任务均由团队的所有成员以相同的方式执行。
我现在开始使用 Python 工作,我想听听您的建议,我应该使用哪些工具来完成与 java 相同的任务。
I used to be a java developer and we used tools like ant or maven to manage our development/testing/UAT environments in a standardized way. This allowed us to handle library dependencies, setting OS variables, compiling, deploying, running unit tests, and all the required tasks. Also, the scripts generated guaranteed that all the environments were almost equally configured, and all the task were performed in the same way by all the members of the team.
I'm starting to work in Python now and I'd like your advice in which tools should I use to accomplish the same as described for java.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
virtualenv 创建包含的虚拟环境(防止不同版本的Python或Python包踩踏彼此)。 人们转向使用此工具的呼声越来越高。 作者与 Aaron 提到的旧的working-env.py 相同。
pip 在 virtualenv 中安装软件包。 传统的方法是 easy_install,正如 S. Lott 所回答的那样,但 pip 与 virtualenv 配合使用效果更好。 easy_install 仍然具有 pip 中没有的功能。
scons 作为构建工具,尽管如果您纯粹使用 Python,则不需要它。
Fabric 粘贴,或 paver 用于部署。
buildbot 用于持续集成。
用于版本控制的 Bazaar、mercurial 或 git。
Nose 作为单元测试的扩展。
PyFit 用于FIT 测试。
virtualenv to create a contained virtual environment (prevent different versions of Python or Python packages from stomping on each other). There is increasing buzz from people moving to this tool. The author is the same as the older working-env.py mentioned by Aaron.
pip to install packages inside a virtualenv. The traditional is easy_install as answered by S. Lott, but pip works better with virtualenv. easy_install still has features not found in pip though.
scons as a build tool, although you won't need this if you stay purely Python.
Fabric paste, or paver for deployment.
buildbot for continuous integration.
Bazaar, mercurial, or git for version control.
Nose as an extension for unit testing.
PyFit for FIT testing.
我还使用 java 和 python。
对于 python 开发,maven 等效项是 setuptools (http://peak.telecommunity.com/DevCenter/setuptools)。 对于 Web 应用程序开发,我将其与 Paste (http://pythonpaste.org/) 结合使用来进行部署过程
I also work with both java and python.
For python development the maven equivalent is setuptools (http://peak.telecommunity.com/DevCenter/setuptools). For web application development I use this in combination with paster (http://pythonpaste.org/) for the deployment process
除了 easy_install 之外?
对于我们的 Linux 服务器,我们使用 easy_install 和 yum。
对于我们的 Windows 开发笔记本电脑,我们在某些项目中使用 easy_install 和一些 MSI。
我们使用的大多数 Python 库都是纯源代码,因此我们可以在所有机器上使用相同的发行版。 如果我们有一个网络共享设备,我们会把它们全部放在那里。 遗憾的是,我们的基础设施有点分散,因此我们必须移动 .TAR 文件或重做安装来重建环境。
在某些情况下(例如,PIL),我们必须重新编译并检查版本号。
Other than easy_install?
For our Linux servers, we use easy_install and yum.
For our Windows development laptops, we use easy_install and a few MSI's for some projects.
Most of the Python libraries we use are source-only, so we can use the same distribution on all boxes. If we could have a network shared device, we'd put them all there. Sadly, our infrastructure is kind of scattered, so we have to either move .TAR files around or redo the installs to rebuild the environments.
In a few cases (e.g., PIL), we have to recompile and check the version numbers.
您将需要 easy_setup 来获取彩蛋(大致就是 Maven 所说的工件)。
要设置您的环境,请查看 working-env.py
Python 不是已编译,但您可以将项目的所有文件放在一个 Egg 中。 这是通过 setuptools 完成的
对于 CI,请检查 这个答案。
You will want easy_setup to get the eggs (roughly what Maven calls an artifact).
For setting up your environment, have a look at working-env.py
Python is not compiled but you can put all files for a project in an egg. This is done with setuptools
For CI, check this answer.
如果我们不提及 Paver,那就太失职了,它是由 TurboGears 名声大噪。 该项目仍处于 alpha 阶段,但看起来非常有前途。 项目页面的片段:
We would be remiss not to also mention Paver, which was created by Kevin Dangoor of TurboGears fame. The project is still in alpha, but it appears very promising. A snippet from the project page:
我正是结合 setuptools 和 Hudson 来完成此操作。 我知道 Hudson 是一个 Java 应用程序,但它可以很好地运行 Python 的东西。
I do exactly this with a combination of setuptools and Hudson. I know Hudson is a java app, but it can run Python stuff just fine.
您可能需要查看我们的 Devenv。 它允许您标准化开发、QA 和 UAT 的构建环境。 它是免费的,就像“免费啤酒”一样。
华泰
You might want to check our Devenv. It allows you to standardize the build environments for development, QA and UAT. It's free as in "free beer".
HTH