我应该如何向 PyPI 注册一个包? [英] How am I supposed to register a package to PyPI?
问题描述
在打包和分发 Python 包的文档中,它说要使用 twine
与 repository = https://upload.pypi.org/legacy/
在 .pypirc
中.现在这个 URL 既是——从它的最后一点来看——既是一种传统的做事方式,又是一种不存在的方式:
In the documentation for packaging and distributing Python packages, it says to use twine
with repository = https://upload.pypi.org/legacy/
in .pypirc
. Now this URL is both – from the last bit of it – a legacy way to do things, and a non-existing one at that:
$ 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 工具?
Is using scriptdoctest.egg-info/PKG-INFO
now the preferred and only way to register a package, or is there some other way to do this with twine
or some other CLI tool?
推荐答案
https://packaging.python.org/distributing/ 实际上提供了所有必要的信息.
https://packaging.python.org/distributing/ actually provides all necessary information.
- 创建一个有效的项目,尤其是
setup.py
python setup.py sdist bdist_wheel
- 确保您拥有正确的
~/.pypirc
以及来自 https 的凭据://pypi.python.org/pypi twine upload dist/*
- 不再需要/可以注册
- Create a valid project, especially
setup.py
python setup.py sdist bdist_wheel
- Make sure you have a correct
~/.pypirc
with your credentials from https://pypi.python.org/pypi twine upload dist/*
- it is no longer necessary/possible to register
我的.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]
这篇关于我应该如何向 PyPI 注册一个包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!