setup.py 中 extras_require 的依赖链接
·
回答问题
1.有没有办法在安装带有附加功能的包时自动处理依赖链接,而不必像install_requires
那样调用--process-dependency-links
?
pip install -e .[extra] --process-dependency-links
我需要这个,因为依赖项仅位于私有 git 存储库中。
- 是否可以使用
python setup.py install
安装附加功能?
3.--process-dependency-links
已经被弃用了,还需要考虑吗?我不确定这里的状态。
Answers
1.是的,如果您使用extras_require
,您将不再需要--process-dependency-links
。
使用 pip 版本 19.3.1 测试
例子:
$ pip install -e .[graphs]
# setup.py
from setuptools import setup
setup(
name='myservice',
version='0.1.0',
install_requires=[
'requests',
],
extras_require={
'graphs': [
'graphcommons @ git+ssh://git@github.com/graphcommons/graphcommons-python@master',
],
},
)
通过使用 ssh 协议(而不是 https)访问 git 存储库,您可以从您的私有存储库进行安装。
-
不确定
python setup.py install
但pip install .[extras]
应该够好吗? -
是的,在 pip 版本 19 中。
更多推荐
所有评论(0)