【问题标题】:How to include projects in personal SCM repositories (not in pypi) to setup.py?如何将个人 SCM 存储库(不在 pypi 中)中的项目包含到 setup.py 中?
【发布时间】:2013-02-10 14:29:06
【问题描述】:

构建依赖于其他源代码控制存储库中的项目(例如,不在 pypi 上的私有项目)的 python 项目的惯用方式是什么?

假设我有一个项目foobar 托管在https://example.com/foobar.git,我想将它包含在另一个项目的setup.py 中。

有没有类似于maven的scm插件的东西,我可以在里面指定Extension('foobar', scm='scm:git:https://example.com/foobar.git')之类的东西

【问题讨论】:

    标签: python build distutils setup.py pypi


    【解决方案1】:

    您可以使用dependency_links 选项指定安装依赖项的其他位置:

    setup(
        ...
        dependency_links=[
            'git+https://example.com/spamneggs/foobar.git#egg=foobar-1.2.3'
        ]
        install_requires=[
            'foobar',
        ]
    )
    

    dependency_links 条目用于查找包,对于 SCM 存储的包,#egg=package-version 片段标识符可让工具知道在该链接中可以找到什么包和版本。

    请参阅 setuptools 项目文档的"Dependencies that aren’t in PyPI" chapter。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-08-05
      • 2017-05-28
      • 1970-01-01
      • 2010-09-25
      • 2012-03-17
      • 1970-01-01
      • 1970-01-01
      • 2017-04-26
      相关资源
      最近更新 更多