tox的问题,其中requirements.txt引用索引

时间:2017-08-27 16:25:24

标签: python pip setuptools tox

我遇到了运行tox的问题,这取决于requirements.txt,它指定了安装本地devpi实例上托管的本地软件包所需的索引。

具体来说,我得到以下(缩写)错误,

> rm -rf ./tox
> tox -e flake8
flake8 create: /Users/john_bodley/my-project/.tox/flake8
flake8 installdeps: -r/Users/john_bodley/my-project/requirements.txt, flake8, flake8-commas, flake8-import-order, flake8-quotes
...
No matching distribution found for some-local-package==1.2.3 (from -r /Users/john_bodley/my-package/requirements.txt (line 4))

但是,如果我重新运行tox -e flake8命令,它可以工作。此外,以下工作,

pip install -r requirements.txt
pip install -e . 

有谁知道可能的解决方案?注意我还不确定如何为给定的测试禁用pip install -e .安装命令,因为flask8实际上并不需要它。

供参考我正在使用pip v9.0.1和tox v2.7.0。以下是requirements.txttox.ini文件的上下文。

requirements.txt:

--index http://example.com/john_bodley/prod/+simple/
--trusted-host example.com
some-local-package==1.2.3

tox.ini:

[flake8]
application-import-names = my-package
import-order-style = google
max-line-length = 80

[testenv]
commands =
    pip wheel -w {homedir}/.wheelhouse -f {homedir}/.wheelhouse .
    py.test tests
deps =
    -r{toxinidir}/requirements.txt
    pytest
    pytest-flask
    wheel
usedevelop = True

[testenv:eslint]
commands = npm run lint
whitelist_externals = npm

[testenv:flake8]
commands = flake8
deps =
    -r{toxinidir}/requirements.txt
    flake8
    flake8-commas
    flake8-import-order
    flake8-quotes

[tox]
envlist = eslint,flake8,py27

1 个答案:

答案 0 :(得分:4)

此行不正确:

--index http://example.com/john_bodley/prod/+simple/

有效选项为--index-url--extra-index-url(任何一个应该适用于您的情况)。如果您也想要搜索PyPI,请使用后者;如果您只想搜索本地索引,则使用前者。