如何编写setup.py以包含一个git repo作为依赖关系 [英] How to write setup.py to include a git repo as a dependency

查看:138
本文介绍了如何编写setup.py以包含一个git repo作为依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的包编写setup.py。我的包需要指定对另一个git repo的依赖。

I am trying to write setup.py for my package. My package needs to specify a dependency on another git repo.

这是我迄今为止所做的:

This is what I have so far:

from setuptools import setup, find_packages

setup(
    name='abc',
    packages=find_packages(),
    url='https://github.abc.com/abc/myabc',
    description='This is a description for abc',
    long_description=open('README.md').read(),
    install_requires=[
        "requests==2.7.0",
        "SomePrivateLib>=0.1.0",
        ],
    dependency_links = [
     "git+git://github.abc.com/abc/SomePrivateLib.git#egg=SomePrivateLib",
    ],
    include_package_data=True,
)

当我运行时:

pip install -e https://github.abc.com/abc/myabc.git#egg=analyse

我得到

找不到满足要求的版本SomePrivateLib> = 0.1.0(from analyze)(from versions:)
没有找到匹配的发行版rivateLib> = 0.1.0(从分析)

我做错了什么?

推荐答案

您可以找到正确的方法来实现这里

You can find the right way to do it here.

dependency_links=['http://github.com/user/repo/tarball/master#egg=package-1.0']

密钥不是指向git存储库的链接,而是链接到tarball。如果您附加 / tarball / master ,Github会为您创建主分支的tarball。

The key is not to give a link to a git repository, but a link to a tarball. Github creates a tarball of the master branch for you if you append /tarball/master as shown above.

这篇关于如何编写setup.py以包含一个git repo作为依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆