简体   繁体   English

如何将个人SCM存储库(不是pypi)中的项目包含到setup.py中?

[英]How to include projects in personal SCM repositories (not in pypi) to setup.py?

What's the idiomatic way to build python projects that depend on projects in other source control repositories (eg private projects not on pypi)? 构建依赖于其他源代码控制存储库中的项目的python项目的惯用方法是什么(例如私有项目不在pypi上)?

Let's say I have a project foobar hosted at https://example.com/foobar.git and I want to include it in the setup.py of another project. 假设我在https://example.com/foobar.git有一个项目foobar ,我希望将它包含在另一个项目的setup.py中。

Is there something similar to maven's scm plugin, where I can specify something like Extension('foobar', scm='scm:git:https://example.com/foobar.git') 是否有类似于maven的scm插件,我可以在其中指定类似Extension('foobar', scm='scm:git:https://example.com/foobar.git')

You can specify additional places to install dependencies from using the dependency_links option: 您可以使用dependency_links选项指定其他安装dependency_links项的位置:

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

The dependency_links entry is used to find packages, and for SCM-stored packages the #egg=package-version fragment identifier lets tools know what package and what version will be found at that link. dependency_links条目用于查找包,对于SCM存储包, #egg=package-version片段标识符允许工具知道将在该链接中找到哪个包和版本。

See the "Dependencies that aren't in PyPI" chapter of the setuptools project documentation. 请参阅setuptools项目文档中的“不在PyPI中的依赖项”一章

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM