【问题标题】:Issue with tox where requirements.txt references an index在 requirements.txt 引用索引时出现 tox 问题
【发布时间】:2017-08-27 16:25:24
【问题描述】:

我在运行 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 . install 命令,因为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

【问题讨论】:

    标签: python pip setuptools tox


    【解决方案1】:

    此行不正确:

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

    有效选项为--index-url--extra-index-url(任何一个都适合您的情况)。如果您还希望搜索 PyPI,请使用后者,如果您只想搜索本地索引,请使用前者。

    【讨论】:

      猜你喜欢
      • 2021-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-16
      • 1970-01-01
      • 2013-09-27
      • 1970-01-01
      相关资源
      最近更新 更多