简体   繁体   English

如何编写 setup.py 以包含特定的 git repo 作为依赖项

[英]How to write setup.py to include a specific git repo as a dependency

My package has a dependency to a another git repo.我的包依赖于另一个 git repo。 My current setup.py file is the following:我当前的 setup.py 文件如下:

#!/usr/bin/env python
# coding: utf-8

from setuptools import setup, find_packages

setup(
  name='myapp', 
  url='git@ssh.xxxxx/dummy/myapp.git',
  packages=find_packages(), 
  install_requires = [
     'base @ git+ssh://git@ssh.xxxx/dummy/base.git'
  ]
)

When I run the command "pip3 install . --user" to execute the setup.py file a base module is installed at userbase/lib/python3.6/site-packages, but this modul is not my base module.当我运行命令“pip3 install . --user”来执行 setup.py 文件时,一个基本模块安装在 userbase/lib/python3.6/site-packages,但这个模块不是我的基本模块。 The first line in the console after running the pip3 install command is运行 pip3 install 命令后控制台中的第一行是

Collecting base@ git+ssh://git@ssh.xxxx/dummy/base.git (from myapp==0.0.0)
Downloading https://files.pythonhosted.org/packages/1b/e5/464fcdb2cdbafc65f0b2da261dda861fa51d80e1a4985a2bb00ced080549/base-1.0.4.tar.gz"
Installing collected packages: base, myapp

It seems to me that pip3 is installing another base module, because the download path is not my git path.在我看来 pip3 正在安装另一个基本模块,因为下载路径不是我的 git 路径。 After that, the base folder in site-packages includes among other files a "taobao.py" and "seo.py" file.之后,站点包中的基本文件夹包括“taobao.py”和“seo.py”文件。

Is there an option that pip3 is installing my base and not another base module?是否有 pip3 安装我的基础而不是另一个基础模块的选项?

I'm using pip 19.03.我正在使用 pip 19.03。

The syntax 'base @ git+ssh://git@ssh.xxxx/dummy/base.git' is supported by pip 19.1+ : pip 19.1+支持语法'base @ git+ssh://git@ssh.xxxx/dummy/base.git'

Since version 19.1, pip also supports direct references like so:从 19.1 版开始,pip 还支持直接引用,如下所示:

 SomeProject @ file:///somewhere/...

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

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