Download and create the devpi container
To download the image run the following command:
docker pull scrapinghub/devpi
This may take a while if you haven't downloaded the ubuntu image before. After that is done you can create the container with autorestart enabled (needs at least docker 1.2):
docker run -d --restart=always --name devpi -p 3141:3141 scrapinghub/devpi
docker run -d --name devpi -p 3141:3141 scrapinghub/devpi
Configure pip
[global] index-url = http://localhost:3141/root/pypi/+simple/
export PIP_INDEX_URL=http://127.0.0.1:3141/root/pypi/+simple/
install devpi-client on virtualenv
$ virtualenv minimalbase $ (minimalbase) pip install devpi-client
devpi use http://127.0.0.1:3141/
Warning: insecure http host, trusted-host will be set for pip using server: http://127.0.0.1:3141/ (not logged in) no current index: type 'devpi use -l' to discover indices venv for install/set commands: /Users/sanjeev/Development/pyenvs/minimalbase only setting venv pip cfg, no global configuration changed /Users/sanjeev/Development/pyenvs/minimalbase/pip.conf: no config file exists always-set-cfg: no
root
root is the default user that has /root/pypi is a read-only proxy link to the PyPI repo at https://pypi.org. Its purpose is to install packages when they are not available on your local devpi instance.To upload packages to the local instance, you need to create a non-root user and an index first.
$ devpi login root # by default, only root can create new users $ devpi user -c san password=test # create new user
root
san
$ devpi login san --password test # relogin as the new user
logged in 'san', credentials valid for 10.00 hours
then run the below command to create a new index for the new use
$ devpi index -c packages bases=root/pypi # create new index
navigate to http://127.0.0.1:3141/san/packages in browser and you will see a json result
The configuration in .pypirc changes to:
[devpi] repository:http://127.0.0.1:3141/san/packages username:san password:test
$ pip install maildiff --extra-index-url=http://127.0.0.1:3141/san/packages