setup.py忽略完整路径依赖性,而是在pypi中查找“最佳匹配”

Jav*_*zzi 5 python pip setuptools setup.py

类似于/sf/ask/876294961/

我正准备与验证器一起开放的PR,因此正在修改造假者,并且希望能够测试我将拥有的新依赖项。

setup(
    name='Faker',
    ...
    install_requires=[
        "python-dateutil>=2.4",
        "six>=1.10",
        "text-unidecode==1.2",
    ],
    tests_require=[
        "validators@https://github.com/kingbuzzman/validators/archive/0.13.0.tar.gz#egg=validators-0.13.0",  # TODO: this will change  # noqa
        "ukpostcodeparser>=1.1.1",
        ...
    ],
    ...
)
Run Code Online (Sandbox Code Playgroud)

python setup.py test 拒绝安装0.13.0版本。

如果我将故障线向上移动install_requires=[..](应该不存在)

setup(
    name='Faker',
    ...
    install_requires=[
        "python-dateutil>=2.4",
        "six>=1.10",
        "text-unidecode==1.2",
         "validators@https://github.com/kingbuzzman/validators/archive/0.13.0.tar.gz#egg=validators-0.13.0",  # TODO: this will change  # noqa
    ],
    tests_require=[
        "ukpostcodeparser>=1.1.1",
        ...
    ],
    ...
)
Run Code Online (Sandbox Code Playgroud)
  • 使用pip install -e .一切都很好-安装了正确的版本。
  • 使用python setup.py develop相同的问题。

My guess is setuptools/distutils doing something weird -- pip seems to address the issue. My question: how do I fix this?

Problematic code and references can be found here:

Easiest way to see the issue at hand:

docker run -it --rm python:3.7 bash -c "git clone https://github.com/kingbuzzman/faker.git; cd faker; pip install -e .; python setup.py test"
Run Code Online (Sandbox Code Playgroud)

UPDATE: Since this has been fixed, the issue wont be replicated anymore -- all tests will pass

hoe*_*ing 3

不幸的是,还不setup_requires支持tests_require来自 PEP 508 的基于 URL 的查找或环境标记。dependency_links例如,您需要使用

setup(
    ...
    tests_require=["validators>=0.13.0"],
    dependency_links=['git+https://github.com/kingbuzzman/validators@master#egg=validators-0.13.0'],
)
Run Code Online (Sandbox Code Playgroud)