7

I have setup a pypiserver behind an nginx proxy which uses htpasswd for authentication. I am currently able to upload sdists, but I can't figure out how to download them. I want to be able to download them when running setup.py test and somehow by using pip. Is this possible?

[distutils]
index-servers =
    private

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

To make it extra hard the server is currently using a non verified ssl connection.

I tried the following setup based on http://pythonhosted.org/setuptools/setuptools.html#setuptools-package-index, but the only documentation on this is '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 Answers 2

7

for using your index with pip create ~/.pip/pip.conf with this content:

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

A little bit documentation on pip.conf is here and on pypiserver here

Perhaps you can also try using package_index='https://user:[email protected]/pypi/simple in setup.py.

Sign up to request clarification or add additional context in comments.

2 Comments

I think the index-url seems alright, but I get errors about the ssl certificate. I should probably get that fixed first anyway. About the package_index kwarg; setuptools complains it is an invalid argument. I have nu clue what to use instead
I added the line about making your CA known to pip, so that it doesn't complain.
3

The server certificate had to be setup properly. For uploading using pip one must create a valid ~/.pypirc file:

[distutils]
index-servers = example

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

For installing packages one needs to add the following section to .pip/pip.conf

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

As knitti noted in a previous answer it is also possible to user index-url instead of extra-index-url. This does mean that the cheese shop is not used as a second server.

For using a private server with setuptools unittesting you need to add the following to your setup.py:

from setuptools import setup

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.