Update a PyPI package

Question:

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

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?

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!

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

Asked By: Alex

||

Answers:

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).

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.

Don’t replace a released package with a silent bugfix. Do not be tempted. Just make a new release.

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.

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.

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.

Answered By: Martijn Pieters
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.