Support `copy()` for `zipfile`
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Feature or enhancement
Proposal:
Currently, copying an entry within a ZIP file is cumbersome due to the lack of support for simultaneous reading and writing. The implementer must either:
- Read the entire entry and write afterwards (which is memory-intensive and inefficient for large files), or
- Use a temporary file for buffered copying.
Both approaches are more complex and less performant, due to the need to decompress and recompress data.
It would be much more performant and friendly by implementing a copy() method, using the similar internal buffered copying technique introduced by #134627 with the internal _ZipRepacker.
This also opens the door to support an efficient move() operation, composed of copy(), remove(), and optionally repack().
Linked PRs
- gh-151825
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先阅读 zipfile 模块的入口,以及 issue #134627 引入的内部 _ZipRepacker 方案。此次更改应支持在归档以读写方式打开时高效复制条目,并在实现之前确定行为和边界情况。关联的 PR gh-151825 表明相关工作已经在进行中。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- tooling
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100