2014-02-26 44 views
4

我已經在使用htpasswd進行身份驗證的nginx代理之後設置了一個pypiserver。我目前能夠上傳sdists,但我無法弄清楚如何下載它們。我希望能夠在運行setup.py test時以及以某種方式通過使用pip來下載它們。這可能嗎?從私人pypiserver安裝python包

[distutils] 
index-servers = 
    private 

[private] 
repository = https://example.com/pypi 
username = remco 
password = mypass 

爲了使服務器目前使用未經驗證的ssl連接更加困難。

我試圖根據http://pythonhosted.org/setuptools/setuptools.html#setuptools-package-index以下設置,但在這唯一的文檔是使用索引與pip創建~/.pip/pip.conf與此內容「XXX」

#!/usr/bin/env python2.7 

from setuptools import setup 


setup(
    name='asd', 
    version='0.0.1', 
    package_index='https://example.com/pypi/simple', 
    test_suite='test', 
    tests_require=['foo==0.0.1']) 

回答

2

必須正確設置服務器證書。 對於上傳使用PIP必須建立一個有效的~/.pypirc文件:

[distutils] 
index-servers = example 

[example] 
repository = https://example.com/pypi 
username = myname 
password = mypass 

對於安裝一個需要下面的部分添加到.pip/pip.conf

[global] 
extra-index-url = https://myname:[email protected]/pypi/simple 

由於knitti在前面的回答指出套餐,也可以到用戶index-url而不是extra-index-url。這確實意味着奶酪店不被用作第二臺服務器。

對於使用專用服務器與setuptools的單元測試,你需要以下內容添加到您的setup.py

from setuptools import setup 

setup(
    ... 
    dependency_links=[ 
     'https://myname:[email protected]/pypi/packages/' 
    ]) 
5

[global] 
index-url = https://remco:[email protected]/pypi/simple 
cert = /etc/ssl/certs/your_cert_CA.pem 

pip.conf的一點點文件是here和pypiserver here

也許你也可以嘗試使用package_index='https://user:[email protected]/pypi/simplesetup.py

+1

我認爲該指數的URL看起來還好,但我得到的SSL證書錯誤。無論如何,我應該首先修正這個問題。關於package_index kwarg; setuptools抱怨說這是一個無效的參數。我不知道用什麼來代替 –

+1

我添加了關於使你的CA知道pip的一行,以便它不會抱怨。 – knitti