配置以便 pip install 可以从 github 工作 [英] Configuring so that pip install can work from github

查看:42
本文介绍了配置以便 pip install 可以从 github 工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们想使用 pip 和 github 将私有包安装到我们的生产服务器.此问题涉及 github 存储库中需要包含哪些内容才能成功安装.

We'd like to use pip with github to install private packages to our production servers. This question concerns what needs to be in the github repo in order for the install to be successful.

假设有以下命令行(验证正常并尝试安装):

Assuming the following command line (which authenticates just fine and tries to install):

pip install git+ssh://git@github.com/BlahCo/search/tree/prod_release_branch/ProductName

ProductName 中需要包含什么?它是使用 sdist 选项运行 setup.py 后通常在 tar 文件中的内容,还是实际的 tar.gz 文件或其他内容?

What needs to reside in the ProductName? Is it the contents of what would normally be in the tar file after running setup.py with the sdist option, or is the actual tar.gz file, or something else?

我在这里问是因为我已经尝试了几种变体但无法使其正常工作.任何帮助表示赞赏.

I'm asking here because I've tried several variations and can't make it work. Any help appreciated.

推荐答案

你需要整个 python 包,其中有一个 setup.py 文件.

You need the whole python package, with a setup.py file in it.

名为 foo 的包将是:

foo # the installable package
├── foo
│   ├── __init__.py
│   └── bar.py
└── setup.py

然后从 github 安装:

And install from github like:

$ pip install git+ssh://git@github.com/myuser/foo.git
or
$ pip install git+https://github.com/myuser/foo.git@v123
or
$ pip install git+https://github.com/myuser/foo.git@newbranch

更多信息请访问 https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support

这篇关于配置以便 pip install 可以从 github 工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆