简体   繁体   English

如何让 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

I'm trying to use tox for my tests.我正在尝试使用 tox 进行测试。

So far it worked great, but now I'm trying to add a dependency to another of my packages.到目前为止它工作得很好,但现在我正在尝试将依赖项添加到我的另一个包中。 I have build a wheel locally and specified the link to it in the setup.py dependency_links, but now when running tox I get the following error:我已经在本地构建了一个轮子并在 setup.py dependency_links 中指定了指向它的链接,但是现在运行 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)

Here's my setup.py:这是我的 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',
      ]
)

My wheel is located here on my machine: D:\python\graph-it\dist\graph_it-0.1.0-py3-none-any.whl我的轮子位于我的机器上:D:\python\graph-it\dist\graph_it-0.1.0-py3-none-any.whl

What am I missing?我错过了什么? :D :D

Thanks!谢谢!

My advice would be:我的建议是:

  • Get rid of dependency_links , since as already mentioned, it is deprecated.摆脱dependency_links ,因为如前所述,它已被弃用。
  • Do not call python setup.py install , it is also deprecated.不要调用python setup.py install ,它也已被弃用。 Use pip install.使用pip install. or pip install --editable.pip install --editable. instead.反而。
  • Use pip's --find-links option to point to the local directory containing the locally built wheels: pip install --find-links 'D:\python\graph-it\dist'.使用 pip 的--find-links选项指向包含本地构建的轮子的本地目录: pip install --find-links 'D:\python\graph-it\dist'.
  • You can also add a line --find-links 'D:\python\graph-it\dist' to a requirements.txt file.您还可以在requirements.txt文件中添加一行--find-links 'D:\python\graph-it\dist' Note that this is not portable.请注意,这是不可移植的。 You could use a relative path instead, and maybe it is a bit more portable.您可以改用相对路径,也许它更便携。
  • For tox:对于毒物:
    • You could try to call tox with apip environment variable , like this: PIP_FIND_LINKS='D:\python\graph-it\dist' tox您可以尝试使用pip 环境变量调用 tox ,如下所示: PIP_FIND_LINKS='D:\python\graph-it\dist' tox
    • You could put the path to the wheel file in the deps of tox.ini : deps = graph-it @ D:\python\graph-it\dist\graph_it-0.1.0-py3-none-any.whl .您可以将轮文件的路径放在tox.inidepsdeps = graph-it @ D:\python\graph-it\dist\graph_it-0.1.0-py3-none-any.whl
    • Here is a tox example showing how to use pip's find-links in tox. 这是一个 tox 示例,展示了如何在 tox 中使用 pip 的find-links

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何让setup.py列出依赖项? - How can I ask setup.py to list dependencies? 从 setup.py pip 安装 tox 的测试依赖项 - pip install test dependencies for tox from setup.py 使用 Tox 复制 setup.py 依赖项 - Copying setup.py Dependencies with Tox 使用setup.py和wheels安装软件包依赖项 - Install package dependencies with setup.py and wheels 如何让我的setup.py使用我的文件的相对路径? - How can I get my setup.py to use a relative path to my files? 如何在我的 package 中获取 setup.py (setuptools) 中定义的版本? - How can I get the version defined in setup.py (setuptools) in my package? 如何从 setup.py 中读取来自 pyproject.toml 的项目依赖项,以避免在两个文件中重复信息? - How do I read project dependencies from pyproject.toml from my setup.py, to avoid duplicating the information in both files? 如何在没有 setup.py 的项目中运行 tox? - How do I run tox in a project that has no setup.py? 如何告诉&#39;setup.py&#39;包含根目录中的文件以进行构建发行版? - How can I tell 'setup.py' to include files from my root directory for the built distribution? 如何强制`setup.py test`在我的`virtualenv`中安装依赖项? - How do I force `setup.py test` to install dependencies into my `virtualenv`?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM