Pip: `setup.py` 中的 'install_requires' 中的 VCS 链接不起作用

创建于 2020-04-21  ·  3评论  ·  资料来源: pypa/pip

环境

  • 点子版本:20.0.2
  • Python版本:3.8
  • 操作系统:Debian GNU/Linux 10(破坏者)

描述

我想在setup.py文件的'install_requires'部分使用 VCS 需求说明符,例如git+git://github.com/...

python setup.py install --user失败并显示以下错误消息:

goblin setup 命令中的错误:“install_requires”必须是包含有效项目/版本要求说明符的字符串或字符串列表; 无效要求,在“'+ git://g '”处解析错误

预期行为

我希望安装成功并完全按照setup.py中的指定安装依赖项。

如何复制

使用来自https://github.com/kkom/goblin/blob/4d112b95dfd2374363b4617b08d3f0689957ea73/setup.pysetup.py文件:

"""Python toolkit for Tinker Pop 3 Gremlin Server."""

import os
from setuptools import find_packages, setup


__author__ = 'Jeffrey Phillips Freeman'
__email__ = '[email protected]'
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2017, CleverThis, Inc. and contributors'
__credits__ = ['David M. Brown - Project founder']

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

setup(
    name='goblin',
    version='2.2.4',
    license=__license__,
    author=__author__,
    author_email=__email__,
    description='Goblin OGM for the Tinkerpop 3 Stack,',
    long_description_content_type="text/markdown",
    long_description=long_description,
    url='http://goblin-ogm.com',
    download_url='https://github.com/goblin-ogm/goblin/archive/v2.2.4.tar.gz',
    include_package_data=True,
    keywords=['Tinkerpop', 'Tinkerpop3', 'gremlin', 'gremlin-python', 'asyncio', 'graphdb', 'ogm', 'orm'],
    packages=find_packages(),
    python_requires='>=3.5',
    install_requires=[
        'git+git://github.com/kkom/aiogremlin.git<strong i="31">@301c9d1dd0cf07b50934c8df2b51084acea86cd7</strong>',
    ],
    test_suite='tests',
    setup_requires=[
        'pytest-runner>=2.6.2',
    ],
    tests_require=['check-manifest>=0.25',
                   'isort>=4.2.2',
                   'pydocstyle>=1.0.0',
                   'pytest-asyncio>=0.8.0',
                   'pytest-cache>=1.0',
                   'pytest-cov>=2.5.1',
                   'pytest-pep8>=1.0.6',
                   'pytest-timeout>=1.3.4',
                   'pytest>=3.2.1',
                   'uvloop>=0.8.1',
                   'mock'],
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: Apache Software License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        'Programming Language :: Python :: 3.7',
        'Programming Language :: Python :: 3.8',
        # uncomment if you test on these interpreters:
        # 'Programming Language :: Python :: Implementation :: IronPython',
        # 'Programming Language :: Python :: Implementation :: Jython',
        # 'Programming Language :: Python :: Implementation :: Stackless',
        'Programming Language :: Python :: Implementation :: PyPy'
    ]
)

输出

root<strong i="36">@d6698cc1fa7a</strong>:/workspaces/goblin# python setup.py install --user
error in goblin setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Invalid requirement, parse error at "'+git://g'"

额外说明

我知道在'install_requires'中如此精确地固定依赖项是一个完整的反模式。

我这样做只是因为我正在修复aiogremlin中的阻塞错误,这是goblin的依赖项 - 我在我的程序中使用的一个包。

如果您有兴趣,我也在尝试以不同的方式解决这个问题: https ://github.com/jazzband/pip-tools/issues/1111

triage

最有用的评论

您好,我相信 VCS 依赖项的正确格式是install_requires=['aiogremlin @ git+... 。 此外,出于安全原因,不鼓励使用git+git (8f0dbec5734c5197c3b7070987814b584e3f31a6),对于 GitHub,建议改用git+https 。 希望这可以为您解决问题。

所有3条评论

您好,我相信 VCS 依赖项的正确格式是install_requires=['aiogremlin @ git+... 。 此外,出于安全原因,不鼓励使用git+git (8f0dbec5734c5197c3b7070987814b584e3f31a6),对于 GitHub,建议改用git+https 。 希望这可以为您解决问题。

谢谢@McSinyx ,这解决了!

是的 - 关于使用https的安全收益的好点!

实际上,您的解决方案也解决了我在另一个问题上的问题: https ://github.com/jazzband/pip-tools/issues/1111

三连胜! 谢谢@McSinyx!

此页面是否有帮助?
0 / 5 - 0 等级