迁移到 PyPI.org¶
- 页面状态
Obsolete
pypi.org 是新的、重写的 PyPI 版本,取代了传统的 PyPI 代码库。它是人们期望使用的 PyPI 的默认版本。这些是人们与 PyPI.org
互动所需的工具和流程。
Publishing releases¶
pypi.org
是2016年9月起的默认上传平台。
Uploads through pypi.python.org
were switched off on July 3, 2017.
As of April 13th, 2018, pypi.org
is the URL for PyPI.
The recommended way to migrate to PyPI.org for uploading is to ensure that you are using a new enough version of your upload tool.
The default upload settings switched to pypi.org
in the following versions:
twine
1.8.0setuptools
27.0.0Python 2.7.13 (
distutils
update)Python 3.4.6 (
distutils
update)Python 3.5.3 (
distutils
update)Python 3.6.0 (
distutils
update)
In addition to ensuring you’re on a new enough version of the tool for the
tool’s default to have switched, you must also make sure that you have not
configured the tool to override its default upload URL. Typically this is
configured in a file located at $HOME/.pypirc
. If you see a file like:
[distutils]
index-servers =
pypi
[pypi]
repository = https://pypi.python.org/pypi
username = <your PyPI username>
password = <your PyPI username>
Then simply delete the line starting with repository
and you will use
your upload tool’s default URL.
If for some reason you’re unable to upgrade the version of your tool
to a version that defaults to using PyPI.org, then you may edit
$HOME/.pypirc
and include the repository:
line, but use the
value https://upload.pypi.org/legacy/
instead:
[distutils]
index-servers =
pypi
[pypi]
repository = https://upload.pypi.org/legacy/
username = <your PyPI username>
password = <your PyPI password>
(legacy
in this URL refers to the fact that this is the new server
implementation’s emulation of the legacy server implementation’s upload API.)
有关更多详细信息,请参见 规格 for .pypirc
。
Registering package names & metadata¶
Explicit pre-registration of package names with the setup.py register
command prior to the first upload is no longer required, and is not
currently supported by the legacy upload API emulation on PyPI.org.
As a result, attempting explicit registration after switching to using PyPI.org for uploads will give the following error message:
Server response (410): This API is no longer supported, instead simply upload the file.
The solution is to skip the registration step, and proceed directly to uploading artifacts.
使用 TestPyPI¶
传统的 TestPyPI (testpypi.python.org) 不再可用;请使用 test.pypi.org 代替。如果您使用 TestPyPI ,您必须更新您的 $HOME/.pypirc
以处理 TestPyPI 的新位置,例如,用 https://test.pypi.org/legacy/
替换 https://testpypi.python.org/pypi
:
[distutils]
index-servers=
pypi
testpypi
[testpypi]
repository = https://test.pypi.org/legacy/
username = <your TestPyPI username>
password = <your TestPyPI password>
有关更多详细信息,请参见 规格 for .pypirc
。
注册新的用户账户¶
为了帮助减轻针对 PyPI 的垃圾邮件攻击,通过 pypi.python.org
的新用户注册已于 2018年2月20日 关闭。在``pypi.org``的新用户注册是开放的。
浏览软件包¶
虽然 pypi.python.org
仍可能用于其他 PyPA 文档的链接中使用,但浏览软件包的默认界面是 pypi.org
。pypi.python.org 这个域名现在会重定向到 pypi.org ,并可能在未来某个时候被禁用。
下载软件包¶
pypi.org
是下载软件包的默认主机。
管理已发布的软件包和版本¶
pypi.org
为登录用户提供了一个全功能的界面来管理他们发布的软件包和版本。