获取pip与git和github存储库一起工作

Ger*_*ard 8 python git django pip github

我正在编写一个python应用程序,它依赖于另一个由于开发原因而托管在github存储库(从不在pypi中)的应用程序.

让我们称呼它们:

  • 应用正在撰写: AppA
  • 在github中的应用程序: AppB

在App A中,setup.py如下:

# coding=utf-8
import sys
try:
    from setuptools import setup, find_packages
except ImportError:
    import distribute_setup
    distribute_setup.use_setuptools()
    from setuptools import setup, find_packages

setup(
    ...
    install_requires=[
        # other requirements that install correctly
        'app_b==0.1.1'
    ],
    dependency_links=[
        'git+https://github.com/user/app_b.git@0.1.1#egg=app_b-0.1.1'
    ]
)
Run Code Online (Sandbox Code Playgroud)

现在AppA正在逐步建立,Jenkins CI因为下一个错误被抛出而导致失败:

error: Download error for git+https://github.com/user/app_b.git@0.1.1: unknown url type: git+https
Run Code Online (Sandbox Code Playgroud)

有趣的是,这只发生在Jenkins,它在我的电脑上完美运行.我尝试了github提供的其他两个SSH网址,甚至没有考虑下载.

现在,AppA包含在也由Jenkins构建的项目的需求文件中,因此通过手动安装依赖项pip install AppA pip install AppB不是一个选项,依赖项通过包含在中自动安装requirements.txt.

有没有办法让github网址和pit一起工作?

任何帮助将非常感激:)

提前致谢!

Hug*_*res 12

问题不pip在于,是setuptools.负责setup()呼叫的是setuptools包(setuptools或分发项目).

无论是setuptoolsdistribute理解的网址类型,他们了解压缩包/ zip文件.

尝试指向Github的下载URL - 通常是一个zip文件.

您的dependency_links参赛作品可能会是这样的:

dependency_links=[
    'https://github.com/user/app_b/archive/0.1.1.zip#egg=app_b-0.1.1'
]
Run Code Online (Sandbox Code Playgroud)

有关更多信息,请查看http://peak.telecommunity.com/DevCenter/setuptools#dependencies-that-aren-t-in-pypi