获取与画中画Git和github上库工作(Get pip to work with git and

2019-07-19 11:24发布

我书面方式Python应用程序依赖于被在github上存储库发展的原因托管(从来没有在PyPI中)另一个。

让我们称之为:

  • 应用程序被写入: AppA
  • 应用在github上: AppB

在应用程序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'
    ]
)

现在AppA正在建造Jenkins CI每推我让,因为一个错误的抛出一个错误:

error: Download error for git+https://github.com/user/app_b.git@0.1.1: unknown url type: git+https

有趣的是,这只有在詹金斯发生,它完美的作品在我的电脑上。 我试用过其他SSH网址github上给那些甚至不考虑下载。

现在,APPA被包含在一个项目也正在建设詹金斯的需求文件,所以安装通过人工的依赖pip install AppA pip install AppB是不是一种选择,依赖通过被包含在自动安装requirements.txt

有没有什么办法,使PIP和git与github上的url一起工作?

任何帮助将是非常赞赏:)

提前致谢!

Answer 1:

问题不在于有pip ,是setuptools 。 该负责的setup()调用setuptools包(setuptools的或分发的项目)。

无论是setuptoolsdistribute明白那种网址的,他们了解压缩包/ zip文件。

尝试指向Github上的下载网址 - 通常是一个zip文件。

dependency_links条目可能会是这样的:

dependency_links=[
    'https://github.com/user/app_b/archive/0.1.1.zip#egg=app_b-0.1.1'
]

欲了解更多信息,看看http://peak.telecommunity.com/DevCenter/setuptools#dependencies-that-aren-t-in-pypi



Answer 2:

从PIP文件 -

pip currently supports cloning over git, git+http and git+ssh:

git+git://git.myproject.org/MyProject#egg=MyProject
git+http://git.myproject.org/MyProject#egg=MyProject
git+ssh://git.myproject.org/MyProject#egg=MyProject

尝试更换git+httpsgit+git



文章来源: Get pip to work with git and github repository