Issue with tox where requirements.txt references an index

1.4k views Asked by At

I'm running into an issue with running tox which depends on requirements.txt which specifies a index which is required to install a local package which is hosted on our local devpi instance.

Specifically I get the following (abbreviated) error,

> 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))

however if I re-run the tox -e flake8 command it works. Additionally the following works,

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

Does anyone know of a possible solution? Note I'm also uncertain how to disable pip install -e . install command for a given test given that flask8 doesn't actually require it.

For reference I'm using pip v9.0.1 and tox v2.7.0. Below are the context of the requirements.txt and tox.ini files respectively.

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

There are 1 answers

0
wim On BEST ANSWER

This line is incorrect:

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

Valid options are --index-url or --extra-index-url (either one should work for your case). Use the latter if you want PyPI to be searched also, and the former if you want only your local index searched.