You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add support for removing zip entry in ZipInfo #84356
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2020-04-04.10:20:54.650>created_at=<Date2020-04-03.15:38:22.691>labels= ['type-feature', 'library', '3.9']
title='Add support for removing zip entry in ZipInfo'updated_at=<Date2020-04-04.10:20:54.649>user='https://github.com/yudilevi2'
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.
It probably would have been better to mention it in bpo-6818, 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 bpo-6818 to no longer apply. That's partly why I suggested python-ideas or discuss.python.org.
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.
Activity
yudilevi2 commentedon Apr 3, 2020
ZipInfo currently only allow adding entries to zip archives but doesn't have the ability to remove entries from them - pretty useful feature.
aeros commentedon Apr 4, 2020
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.
serhiy-storchaka commentedon Apr 4, 2020
This is a duplicate of bpo-700858 and bpo-6818.
aeros commentedon Apr 4, 2020
Serhiy Storchaka wrote:
It probably would have been better to mention it in bpo-6818, 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 bpo-6818 to no longer apply. That's partly why I suggested python-ideas or discuss.python.org.
serhiy-storchaka commentedon Apr 4, 2020
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.
yudilevi2 commentedon Apr 4, 2020
Sorry, I didn't see the old issue, let's move the discussion over there -
https://bugs.python.org/issue6818