Upload a new release to TestPyPi

强颜欢笑 提交于 2021-01-24 07:01:27

问题


tl;dr - How do I upload a new release to a TestPyPi project?

Description: I followed these instructions in the Python Package User Guide to import a test package to TestPyPi. However, the package I uploaded has an error. I corrected the error and tried to overwrite the package, but encountered the following error:

Code:

python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*

Error:

HTTPError: 400 Client Error: File already exists. See https://test.pypi.org/help/#file-name-reuse for url: https://test.pypi.org/legacy/

On stack overflow, I found a post stating that a TestPyPi package cannot be overwritten. However, TestPyPi itself indicates that version release should be possible.

When I searched TestPyPi for documentation, I cannot find anything stating how to upload a new version of a package. In one area I found a brief reference to release management, but it is a hyperlink that links to the instructions on how to install a package, not update one (this is the same hyperlink I referenced in the first sentence of this post).

How do I upload a new release to a TestPyPi project?


回答1:


TestPyPI and even PyPI itself have had ability to reuse filenames. But after switching to Warehouse (the new code behind PyPI and TestPyPI) they lost that ability. There is no way to reupload the same filename.

Increase version, regenerate packages and upload new packages with new names.




回答2:


You need to increase the version in setup.py and rerun setup.py; e.g. python3 setup.py sdist bdist_wheel or similar. Good idea to rm -rf dist build and remove the egg-info file too.

You cannot just resubmit the same packaged name and version, it does not auto-overwrite and you can understand why if you think about it logically, if the code changes, you would never want to overwrite a current version that people rely on, because it could break their instance of it, so you practice as you play in test to ensure that you get into good habits.



来源:https://stackoverflow.com/questions/56520660/upload-a-new-release-to-testpypi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!