setup.py忽略完整路径依赖性,而是寻找“最佳匹配".在Pypi中 [英] setup.py ignores full path dependencies, instead looks for "best match" in pypi

查看:107
本文介绍了setup.py忽略完整路径依赖性,而是寻找“最佳匹配".在Pypi中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

类似于 https://stackoverflow.com/questions/12518499/pip-ignores-dependency-links-in-setup-py

我正在修改 faker ,因为我希望通过验证器,我希望能够测试我将拥有的新依赖项.

I'm modifying faker in anticipation to an open PR I have open with validators, and I want to be able to test the new dependency i will have.

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",
        ...
    ],
    ...
)

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

python setup.py test refuses to install the 0.13.0 version.

如果我将故障线移至install_requires=[..](不应存在)

If I move the trouble line up to install_requires=[..] (which SHOULD not be there)

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",
        ...
    ],
    ...
)

  • 使用pip install -e .一切都很好-安装正确的版本.
  • 使用python setup.py develop相同问题.
    • using pip install -e . everything works great -- the correct version gets installed.
    • using python setup.py develop same issue.
    • 我的猜测是setuptools/distutils做一些奇怪的事情-pip似乎解决了这个问题.我的问题:该如何解决?

      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:

      • https://github.com/kingbuzzman/faker/commit/20f69082714fae2a60d356f4c63a061ce99a975e#diff-2eeaed663bd0d25b7e608891384b7298R72
      • https://github.com/kingbuzzman/faker
      • https://gist.github.com/kingbuzzman/e3f39ba217e2c14a9065fb14a502b63d
      • https://github.com/pypa/setuptools/issues/1758

      查看当前问题的最简单方法:

      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"
      

      更新:由于此问题已得到修复,因此该问题将不再重复出现-所有测试都将通过

      推荐答案

      不幸的是,setup_requirestests_require都不支持PEP 508中基于URL的查找或环境标记.您需要使用dependency_links,例如

      Unfortunately, neither setup_requires nor tests_require support URL-based lookup or environment markers from PEP 508 yet. You need to use dependency_links, for example

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

      这篇关于setup.py忽略完整路径依赖性,而是寻找“最佳匹配".在Pypi中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆