自托管 devpi 的客户端 URL?

client URL for self hosted devpi?

我是运行thisdevpidocker容器

按照说明,我在环境变量 DEVPI_PASSWORD 中为 devpi 设置了密码,然后

我已经设置了 ~/.pypirc 文件

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

但是在尝试上传(更新它,因为它包含我的包的旧版本)python 包时我收到错误

$ 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

那么客户端应该是什么 URL?

/root/pypi 是位于 https://pypi.org 的 PyPI 存储库的只读代理 link。其目的是在本地 devpi 实例上不可用时安装软件包。要将包上传到本地实例,您需要先创建一个非root用户和一个索引。在您的主机上,启动容器并(假设从容器到主机的端口映射有效)问题:

$ 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

如果您收到错误 devpi: command not found,请停止容器并在您的主机上安装 devpi-client

$ pip install devpi-client

现在您有一个可以上传到的索引 http://127.0.0.1:3141/me/myindex.pypirc中的配置更改为:

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

从索引安装将通过将索引 url 传递给 pip:

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