.pypirc ####### * .pypirc 文件允许您定义 package indexes(即: repo, 存储库) 的配置,这样,无论何时使用 ``twine`` 或 ``flit`` 上传包,都不必输入 URL、用户名或密码。 示例:: [distutils] index-servers = nexus pypitest [default] repository: nexus [nexus] repository=http://nexus.zhaoweiguo.com/repository/pypi_hosted/ username=user password=pwd [testpypi] repository = https://test.pypi.org/legacy/ username = __token__ password = pypi-... 安全 ==== * 使用 keyring 来安全地存储 API 令牌或密码时,目的是避免在 .pypirc 文件中直接写入明文密码。 先通过 keyring 设置密码:: # Python keyring.set_password("pypi", "__token__", "your-password") # shell keyring set https://upload.pypi.org/legacy/ __token__