我怎样才能让 Tox 从我的 setup.py 中的 dependency_list 找到我的依赖项的本地轮子

How can I get Tox to find the local wheels to my dependencies from dependency_list in my setup.py

我正在尝试使用 tox 进行测试。

到目前为止它运行良好,但现在我正在尝试向我的另一个包添加依赖项。 我已经在本地构建了一个轮子,并在 setup.py dependency_links 中为其指定了 link,但是现在当 运行 tox 时,我收到以下错误:

Collecting PySide2
  Using cached https://files.pythonhosted.org/packages/48/84/b776c8811dd453eb023b5dd05554e0292d5919fdbb881f3c613f57f5cbe2/PySide2-5.15.2-5.15.2-cp35.cp36.cp37.cp38.cp39-none-win32.whl
Collecting Qt.py>=1.2
  Using cached https://files.pythonhosted.org/packages/cf/08/04c51fb1ee9bbfb2196c956f8a3f7da4e9757710582e8700bf812f258d43/Qt.py-1.3.3-py2.py3-none-any.whl
Collecting pytest-cov
  Using cached https://files.pythonhosted.org/packages/e3/1a/6affecd2344efee7f2487fac82242474cbac09f9e04929da5944907baf11/pytest_cov-2.11.1-py2.py3-none-any.whl
ERROR: Could not find a version that satisfies the requirement graph-it (from ComponentAssembler-abs==0.0.1) (from versions: none)
ERROR: No matching distribution found for graph-it (from ComponentAssembler-abs==0.0.1)

这是我的 setup.py :


with open("README.md", "r") as fh:
    long_description = fh.read()

name = "ComponentAssembler-abs"

author = "me me me"

author_email = "me@somemail.com"

description = "Acyclic Block System"

url = "https://github.com/me me me/ComponentAssembler"

python_requires = '>=3.6, <4'


setup(
      name=name,
      version="0.0.1",
      author=author,
      author_email=author_email,
      description=description,
      long_description=long_description,
      url=url,
      package_dir={'': 'src'},
      packages=find_packages(where='src'),
      classifiers=[
            "Programming Language :: Python :: 3",
            "Operating System :: OS Independent",
      ],
      python_requires=python_requires,
      install_requires=[
          'PySide2',
          'Qt.py>=1.2',
          'pytest-cov',
          'graph-it',
      ],
      dependency_links=[
          'D:\python\graph-it\dist',
      ]
)

我的轮子位于我的机器上:D:\python\graph-it\dist\graph_it-0.1.0-py3-none-any.whl

我错过了什么? :D

谢谢!

我的建议是:

  • 删除 dependency_links,因为如前所述,它已被弃用。
  • 不要调用python setup.py install,它也被弃用了。请改用 pip install .pip install --editable .
  • 使用pip的--find-links选项指向包含本地构建轮子的本地目录:pip install --find-links 'D:\python\graph-it\dist' .
  • 您还可以在 requirements.txt 文件中添加一行 --find-links 'D:\python\graph-it\dist'。请注意,这不是便携式的。您可以改用相对路径,也许它更便于携带。
  • 对于毒素:
    • 您可以尝试使用 pip environment variable 调用 tox,如下所示:PIP_FIND_LINKS='D:\python\graph-it\dist' tox
    • 您可以将 wheel 文件的路径放在 deps of tox.ini 中:deps = graph-it @ D:\python\graph-it\dist\graph_it-0.1.0-py3-none-any.whl.
    • Here is a tox example 显示如何在 tox 中使用 pip 的 find-links