更新 PyPI 包 [英] Update a PyPI package

查看:55
本文介绍了更新 PyPI 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在不改变版本号的情况下更新 PyPI 包?

Is there a way to update a PyPI package without changing the version number?

想象一下,我在最近上传到 PyPI 的包中发现了一个小错误.有没有办法在不增加版本号的情况下编辑/重新上传代码?

Imagine, for a second, that I've found a small bug in a package I recently uploaded to PyPI. Is there a way to edit/re-upload the code without incrementing the version number?

更新我想我应该澄清一下,错误"是指实际源代码中的版本号是错误的——它不是一个功能性的东西,它只是意味着如果你做 package.version 你会得到以前的版本,不是当前的(是的,我知道这可能会导致其他人的代码中出现错误,但鉴于我们处于 alpha 阶段,我希望版本依赖项尚未设置......).作为记录,很明显无声的错误修复是不好的!

UPDATE I guess I should clarify that by "bug" I mean the version number in the actual source code is wrong - it's not a functional thing, it just means if you do package.version you get the previous version, not the current one (and yes I know this could cause a bug in someone else's code, but given we're in alpha I'd hope version dependencies haven't set in just yet...). For the record, clearly silent bug fixes are bad!

更新 2截至 2015 年 1 月,提供的解决方案不再有效 - 请参阅 这篇文章了解更多信息信息.

UPDATE 2 As of Jan 2015 the solution provided is no longer valid - see this post for more information.

推荐答案

当您遇到错误时,总是上传版本.

When you encountered a bug, always upload a new release.

增加版本号,包括一个更新日志,称之为棕色包发布(这不是我,而是有人在他们头上戴着一个棕色包,真的,老实说).

Increase the version number, include a changelog, call it a brown-bag release (it wasn't me, it was someone wearing a brown bag over their heads, really, honestly).

你永远不知道谁可能已经下载了版本的副本(在镜像上,直接从你的 github 页面,无论如何),他们将永远不知道你悄悄地修复了一个错误.此外,那些确实发现您更换了版本的人,现在必须学习如何强制重新安装.

You never know whom already may have downloaded a copy of the release (on a mirror, directly from your github page, whatever) that will never know that you fixed a bug quietly. Moreover, those that did figure out you replaced the release, now have to learn how to force a reinstall.

不要用静默的错误修复替换已发布的包.不要被诱惑.只需发布一个新版本.

另一方面,如果您设法以某种方式破坏了分发文件本身,因此 .zip.tar.gz 文件是 b0rken,那么您需要使用 PyPI 网络界面手动删除文件并重新上传.

If, on the other hand, you managed somehow to corrupt the distribution file itself, so the .zip or .tar.gz file is b0rken, then you need to manually remove the file using the PyPI web interface and re-upload.

截至 1 月 24 日,PyPI 甚至不会让你不再重复使用文件名;这意味着您不能重新上传具有相同版本号的新文件.

As of the 24th of January, PyPI will not even let you reuse a filename anymore; that means that you cannot re-upload a new file with the same version number.

如果你做错的只是打包错误,你可以在版本号中添加一个 .postN 后缀(所以 .post1, .post2等)表示发布后更新.

If all you did wrong was a packaging error, you can add a .postN postfix to the version number (so .post1, .post2, etc.) to indicate a post-release update.

这篇关于更新 PyPI 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆