如何将依赖关系链接添加到setup.py中的repo子目录 [英] How can I add dependency link to repo subdirectory in setup.py

查看:86
本文介绍了如何将依赖关系链接添加到setup.py中的repo子目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下两个存储库: 一种是带有setup.py的经典,另一种是:

I have following two repositories: one classic with setup.py, and second which looks like:

/repo /folder1 /folder2 /utils /setup.py

/repo /folder1 /folder2 /utils /setup.py

和第一个存储库中的setup.py中,我想从第二个存储库中安装utils. 我尝试了以下代码:

and in setup.py in first repo I want install utils from second repo. I tried following code:

install_requires=["repo"],
dependency_links=['git+ssh://git@bitbucket.aaaaaaa.aa:0000/project/repo@master#egg=repo&subdirectory=folder2']

但是在python setup.py开发后,我遇到以下错误:

but after python setup.py develop I have following error:

unknown url type: git+ssh -- Some packages may not be found!

推荐答案

我遇到了同一期问题.

janfreyberg的答案由于pip中的更改而不再起作用: 自19.0起,dependency_links现在已过时.

janfreyberg answer does not work anymore because of a change in pip: since 19.0, dependency_links are now obsolete.

pip 18.1起,我们可以使用

Since pip 18.1, we can put these dependencies in install_requires using a syntax introduced by PEP 508.

这是您的解决方案:

install_requires=[
    'repo @ git+ssh://git@bitbucket.aaaaaaa.aa:0000/project/repo@master#subdirectory=folder2'
]

setup(install_requires=install_requires)

请注意,这需要使用pip install .,而不能与python setup.py install一起使用.

Note that this requires using pip install . and doesn't work with python setup.py install.

如果folder2本身具有依赖项,则将以递归方式检索所有内容.

If folder2 itself has dependencies, everything will be retrieved recursively.

这篇关于如何将依赖关系链接添加到setup.py中的repo子目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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