pip 是否处理来自 setuptools/distribute 源的 extras_requires ?
我有一个包含 setup.py 和 extras_requires 行如下:
extras_require = {
'ssh': ['paramiko'],
},
以及依赖于 util 的包“B”:
install_requires = ['A[ssh]']
如果我在包 B 上运行 python setup.py install
,它使用 setuptools.command .easy_install
在引擎盖下,extras_requires
已正确解析,并且 paramiko 已安装。
但是,如果我运行 pip /path/to/B
或 pip hxxp://.../b-version.tar.gz
,则会安装软件包 A,但是帕里米科不是。
因为 pip “从源安装”,所以我不太确定为什么这不起作用。它应该调用B的setup.py,然后解析&安装 B 和 A 的依赖项。
这可以用 pip 实现吗?
I have package "A" with a setup.py and an extras_requires line like:
extras_require = {
'ssh': ['paramiko'],
},
And a package "B" that depends on util:
install_requires = ['A[ssh]']
If I run python setup.py install
on package B, which uses setuptools.command.easy_install
under the hood, the extras_requires
is correctly resolved, and paramiko is installed.
However, if I run pip /path/to/B
or pip hxxp://.../b-version.tar.gz
, package A is installed, but paramiko is not.
Because pip "installs from source", I'm not quite sure why this isn't working. It should be invoking the setup.py of B, then resolving & installing dependencies of both B and A.
Is this possible with pip?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我们使用
setup.py
和pip
来管理包的开发依赖项,但您需要更新版本的pip
(我们使用的是 1.4)目前为.1)。安装包:
开发:
We use
setup.py
andpip
to manage development dependencies for our packages, though you need a newer version ofpip
(we're using 1.4.1 currently).To install the package:
To develop:
自 2012 年 2 月(提出此问题一年后)发布的 pip 1.1 起就支持这一点。
This is suppported since pip 1.1, which was released in February 2012 (one year after this question was asked).
@aaronfay 的答案是完全正确的,但最好指出,如果您使用
zsh
,则安装命令pip install -e .[dev]
需要替换为pip install -e ".[dev]"
。The answer from @aaronfay is completely correct but it may be nice to point out that if you're using
zsh
that the install commandpip install -e .[dev]
needs to be replaced bypip install -e ".[dev]"
.