client URL for self hosted devpi?

2.2k Views Asked by At

I am running this devpi docker container

as per instruction I have setup password in the environment variable DEVPI_PASSWORD to devpi then

I have setup ~/.pypirc file

[devpi]
repository:http://127.0.0.1:3141/root/pypi
username:root
password:devpi

but on trying to upload (to update it as it contains the old version of my package )the python package I get the error

$ twine upload -r devpi dist/*.tar.gz
Uploading distributions to http://127.0.0.1:3141/root/pypi
Uploading maildiff-1.3.0.tar.gz
100%|███████████████████████████████████████| 16.4k/16.4k [00:00<00:00, 667kB/s]
HTTPError: 404 Client Error: Not Found for url: http://127.0.0.1:3141/root/pypi

so what should be the client URL ?

1

There are 1 best solutions below

10
On BEST ANSWER

/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. On your host, start the container and (assuming the port mapping from container to host worked) issue:

$ devpi use http://127.0.0.1:3141
$ devpi login root                         # by default, only root can create new users
$ devpi user -c me password=mypass         # create new user
$ devpi login me                           # relogin as the new user
$ devpi index -c myindex bases=/root/pypi  # create new index

If you get the error devpi: command not found, stop the container and install devpi-client on your host:

$ pip install devpi-client

Now you have an index http://127.0.0.1:3141/me/myindex you can upload to. The configuration in .pypirc changes to:

[devpi]
repository:http://127.0.0.1:3141/me/myindex
username:me
password:mypass

Installing from the index will work by passing the index url to pip:

$ pip install maildiff --extra-index-url=http://127.0.0.1:3141/me/myindex