如何使用Tox从本地Python存储库安装依赖项?

时间:2019-06-03 18:34:22

标签: python authentication pypi tox

简介

我想使用Tox将一些依赖项(local-package1local-package2)安装到virtualenv中。这些依赖项是仅存在于本地Python软件包索引(在Artifactory实例内部)的软件包。

尝试

这是我的tox.ini

[tox]
envlist = py27
indexserver =
    LOCAL =  https://me:abc123@artifactory.example.com/api/pypi/pypi-local/simple

[testenv]
deps =
    :LOCAL:local-package1
    mock
    pykwalify
    :LOCAL:local-package2
    xlrd
    XlsxWriter
    xlwt
    yamllint
commands =
    make.sh

这是tox -v的输出:

using tox.ini: repo/tox.ini
using tox-3.7.0 from /usr/local/lib/python2.7/site-packages/tox/__init__.pyc
GLOB sdist-make: ~/repo/setup.py
  ~/repo$ /usr/local/opt/python@2/bin/python2.7 ~/repo/setup.py sdist --formats=zip --dist-dir ~/repo/.tox/dist >~/repo/.tox/log/tox-0.log
package .tmp/package/1/example-0.0.0.zip links to dist/example-0.0.0.zip (~/repo/.tox)
py27 cannot reuse: no previous config ~/repo/.tox/py27/.tox-config1
py27 create: ~/repo/.tox/py27
  ~/repo/.tox$ /usr/local/opt/python@2/bin/python2.7 -m virtualenv --python /usr/local/opt/python@2/bin/python2.7 py27 >~/repo/.tox/py27/log/py27-0.log
py27 installdeps: :LOCAL:local-package1, mock, pykwalify, :LOCAL:local-package2, xlrd, XlsxWriter, xlwt, yamllint
  ~/repo$ ~/repo/.tox/py27/bin/python -m pip install -i https://me:abc123@artifactory.example.com/api/pypi/pypi-local/simple local-package1 local-package2 >~/repo/.tox/py27/log/py27-1.log

执行tail -f ~/repo/.tox/py27/log/py27-1.log会产生以下结果:

actionid: py27
msg: getenv
cmdargs: 'repo/.tox/py27/bin/python -m pip install -i https://me:abc123@artifactory.example.com/api/pypi/pypi-local/simple local-package1 local-package2'

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Looking in indexes: https://me:****@artifactory.example.com/api/pypi/pypi-local/simple, https://artifactory.example.com/api/pypi/pypi-local/simple
Collecting local-package1

并且似乎无限期地挂起。

如果我运行命令:

repo/.tox/py27/bin/python -m pip install -i https://me:abc123@artifactory.example.com/api/pypi/pypi-local/simple local-package1 local-package2

在virtualenv之外,我可以安装这些软件包而没有任何问题。

问题

我如何正确地使用Tox安装依赖项,其中包括对Python Package Index的身份验证?

0 个答案:

没有答案