在文档中打包和分发 Python 包 https://packaging.python.org/distributing/,它说使用twine
with repository = https://upload.pypi.org/legacy/
in .pypirc
。现在,这个 URL 从最后一点开始,既是一种传统的做事方式,又是一种不存在的方式:
$ twine register dist/scriptdoctest-0.1-py2.py3-none-any.whl
Registering package to https://upload.pypi.org/legacy/
Enter your username: MyUserName
Enter your password:
Registering scriptdoctest-0.1-py2.py3-none-any.whl
HTTPError: 410 Client Error: This API is no longer supported, instead simply upload the file. for url: https://upload.pypi.org/legacy/
正在使用scriptdoctest.egg-info/PKG-INFO
现在是注册软件包的首选且唯一的方法,或者是否有其他方法可以做到这一点twine
或者其他一些 CLI 工具?
https://packaging.python.org/distributing/ https://packaging.python.org/distributing/实际上提供了所有必要的信息。
TL;DR
- 创建一个有效的项目,尤其是
setup.py
python setup.py sdist bdist_wheel
- 确保你有一个正确的
~/.pypirc
以及您的凭据https://pypi.python.org/pypi https://pypi.python.org/pypi
-
twine upload dist/*
- 不再需要/不可能注册
My .pypirc
看起来如下:
[distutils]
index-servers =
pypi
pypitest
[pypi]
repository=https://pypi.python.org/pypi
username=Martin.Thoma
password=[your password]
[pypitest]
repository=https://testpypi.python.org/pypi
username=Martin.Thoma
password=[your password]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)