具有私人开发的依赖项的 Pylons 应用程序部署
在我的组织中,我们有几个内部开发的 Python 包。为了举例,我们将它们称为 Foo 和 Bar。两者都是在单独的 Git 存储库中开发的。 Foo 是一个 Pylons 应用程序,它使用 Bar 中的某些库函数。两者均未公开分发。
当我们部署 Foo 时,我们通常会从源代码管理中导出最新版本,并在 virtualenv 中运行 setup.pydevelopment
。这工作正常。
问题是我们需要某种方式为部署 Foo 的每个环境分发 Bar。显然我们不能将“Bar”放入setup.py的install_requires中(因为easy_install无法在任何网站上找到它)。我找不到任何自动获取/安装私人开发依赖项的方法。
有没有更简单的方法来管理这个?我觉得我错过了 Python 打包和分发的重点。
In my organization, we have a couple of internally developed Python packages. For sake of example, let's call them Foo and Bar. Both are developed in separate Git repositories. Foo is a Pylons application that uses certain library functions from Bar. Neither is publicly distributed.
When we deploy Foo, we typically export the latest revision from source control and run setup.py develop
within our virtualenv. This works okay.
The problem is that we'll need some way of distributing Bar for every environment where we deploy Foo. We obviously can't put 'Bar' in setup.py's install_requires (as easy_install won't find be able to find it on any website). I can't find any way of automatically obtaining/installing privately developed dependencies.
Is there an easier to way to manage this? I feel like I'm missing the point of Python packaging and distribution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以创建包存储库。步骤基本上是:
请注意,Apache 不是必需的,但它会自动生成 easy_install 可以处理的目录列表。
如果您使用 buildout,则有一些配置选项可以执行与 -f 相同的操作,并且我很确定您也可以在 pip 中使用某些功能。
You can create a package repository. The steps are basically:
Note that Apache is not necessarily required, but it automatically generates a directory listing that easy_install can deal with.
If you are using buildout, there are config options to do the same thing as -f and I am pretty sure there is something you can use in pip as well.
使用 setuptools 时,在 setup.py 中,您可以指定 easy_install 应在其中查找包的 HTTP、FTP 和 SVN 位置:
http://peak.telecommunity.com/DevCenter/setuptools#dependency-that-aren-t-in-pypi
您可以在某些“秘密”中发布 Bar位置,或者,我还没有尝试过,但也许 HTTP 基本身份验证有效:
When using setuptools, in setup.py you can specify HTTP, FTP and SVN locations where easy_install should look for packages:
http://peak.telecommunity.com/DevCenter/setuptools#dependencies-that-aren-t-in-pypi
You can either publish Bar in some "secret" location, or, I haven't tried it but maybe HTTP basic auth works:
在我的工作中,我们使用 setuptools 来创建特定于操作系统的包。我们碰巧使用RedHat,所以我们调用bdist_rpm来创建rpm包。我们发现这比 Eggs 效果更好,因为我们可以在 Python 和非 Python 库的包中进行依赖管理。
我们在持续集成机器上创建 rpm,并将它们移动到 YUM 存储库,在那里可以通过 YUM 更新或升级将它们推出。
At my work we use setuptools to create packages specific to the OS. We happen to use RedHat so we call bdist_rpm to create rpm package. We find that works better than eggs because we can do dependency management in the packages for both python and non-python libs.
We create the rpms on our continuous integration machine and the move them to a YUM repo where they can be pushed out via a YUM update or upgrade.