gpt4 book ai didi

python - 我应该如何将包注册到 PyPI?

转载 作者:太空狗 更新时间:2023-10-29 18:27:21 25 4
gpt4 key购买 nike

packaging and distributing Python packages 的文档中,它说在 .pypirc 中使用 twinerepository = https://upload.pypi.org/legacy/。现在这个 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/实际上提供了所有必要的信息。

长话短说

  1. 创建一个有效的项目,尤其是setup.py
  2. python setup.py sdist bdist_wheel
  3. 确保你有一个正确的 ~/.pypirc 和来自 https://pypi.python.org/pypi 的凭证
  4. twine upload dist/* - 不再需要/不可能注册

我的 .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]

关于python - 我应该如何将包注册到 PyPI?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40022710/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com