This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add support for removing zip entry in ZipInfo
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: aeros, alanmcintyre, serhiy.storchaka, twouters, yudilevi
Priority: normal Keywords: patch

Created on 2020-04-03 15:38 by yudilevi, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 19336 closed yudilevi, 2020-04-03 15:43
Messages (6)
msg365704 - (view) Author: Yudi Levi (yudilevi) * Date: 2020-04-03 15:38
ZipInfo currently only allow adding entries to zip archives but doesn't have the ability to remove entries from them - pretty useful feature.
msg365734 - (view) Author: Kyle Stanley (aeros) * (Python committer) Date: 2020-04-04 00:56
> ZipInfo currently only allow adding entries to zip archives but doesn't have the ability to remove entries from them - pretty useful feature.

This public API enhancement seems substantial enough to warrant a python-ideas ML thread or topic in the "Ideas" category of discuss.python.org. It would help to demonstrate some real-world examples where one may want to programmatically remove entries.

Also, added zipfile maintainers to the nosy list.
msg365750 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-04-04 08:38
This is a duplicate of issue700858 and issue6818.
msg365752 - (view) Author: Kyle Stanley (aeros) * (Python committer) Date: 2020-04-04 09:02
Serhiy Storchaka wrote:
> This is a duplicate of issue700858 and issue6818.

It probably would have been better to mention it in issue6818, but IMO, those issues have been inactive long enough that it's reasonable to re-address the issue. zipfile is not an area of expertise for me though, so I can't say if anything substantial has changed for the arguments against it in issue6818 to no longer apply. That's partly why I suggested python-ideas or discuss.python.org.
msg365753 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-04-04 10:14
There were other issues and discussions about this.

The problem of removing a file from a ZIP archive is similar to the problem of removing a line from a file. It cannot be made efficiently, and it is not even always possible. In some cases it may be better (simpler, more efficient and robust) to copy a file line by line into a new file, skipping particular lines, and the same is true for a ZIP archive. In other cases you can truncate the file or the ZIP archive. Solution that is optimal in one case may be inappropriate in other case.
msg365754 - (view) Author: Yudi Levi (yudilevi) * Date: 2020-04-04 10:20
Sorry, I didn't see the old issue, let's move the discussion over there -
https://bugs.python.org/issue6818
History
Date User Action Args
2022-04-11 14:59:29adminsetgithub: 84356
2020-04-04 10:20:54yudilevisetstatus: open -> closed
resolution: duplicate
messages: + msg365754

stage: patch review -> resolved
2020-04-04 10:14:35serhiy.storchakasetmessages: + msg365753
2020-04-04 09:02:27aerossetmessages: + msg365752
2020-04-04 08:38:02serhiy.storchakasetmessages: + msg365750
2020-04-04 00:56:42aerossetnosy: + alanmcintyre, serhiy.storchaka, twouters, aeros
messages: + msg365734
2020-04-03 15:43:22yudilevisetkeywords: + patch
stage: patch review
pull_requests: + pull_request18699
2020-04-03 15:38:22yudilevicreate