Skip to content

refactor: 使用 zstd 和纯 Python 替代 gzip 和 rsync - #26

Merged
iven merged 2 commits into
mainfrom
iven/budget
Feb 10, 2026
Merged

refactor: 使用 zstd 和纯 Python 替代 gzip 和 rsync#26
iven merged 2 commits into
mainfrom
iven/budget

Conversation

@iven

@iven iven commented Feb 9, 2026

Copy link
Copy Markdown
Contributor

将归档压缩方式从 tar+gzip 改为 tar+zstd,并移除对 rsync 的依赖,改用纯 Python 实现。

主要改动

  • 添加 zstandard 依赖
  • 使用 tarfile 和 zstandard 库替代 tar CLI
  • 使用 SHA-256 checksum 替代 rsync 进行文件同步
  • 文件扩展名从 .tar.gz 改为 .tar.zst
  • 使用 filter='data' 增强解压安全性

优势

  • 更快的压缩速度(提升 39%)
  • 跨平台兼容性更好(Windows 原生支持,无需 rsync)
  • 统一使用 SHA-256,与项目其他部分保持一致
  • 更安全(无 shell 注入风险)
  • 自动避免 macOS 扩展属性问题(不会产生 ._ 文件)

iven added 2 commits February 10, 2026 00:09
将归档压缩方式从 tar+gzip 改为 tar+zstd,使用 Python 库而非 CLI 调用。

主要改动:
- 添加 zstandard 依赖
- 使用 tarfile 和 zstandard 库替代 tar CLI
- 文件扩展名从 .tar.gz 改为 .tar.zst
- 使用 filter='data' 增强解压安全性

优势:
- 更快的压缩/解压速度
- 更好的压缩率
- 纯 Python 实现,跨平台兼容性更好
- 自动避免 macOS 扩展属性导致的跨平台问题(不会产生 ._ 文件)
- 移除对 rsync 的依赖
- 实现 _sync_with_checksum 方法,使用 SHA-256 进行文件内容比较
- 保持与 rsync --checksum 等价的时间戳行为
- 统一使用 SHA-256 哈希算法,与项目其他部分(target、dependency、checksummer)保持一致
@iven iven changed the title iven/budget refactor: 使用 zstd 和纯 Python 替代 gzip 和 rsync Feb 9, 2026
@iven
iven added this pull request to the merge queue Feb 9, 2026
@iven
iven removed this pull request from the merge queue due to a manual request Feb 10, 2026
@iven
iven added this pull request to the merge queue Feb 10, 2026
Merged via the queue into main with commit 4950303 Feb 10, 2026
2 checks passed
@iven
iven deleted the iven/budget branch February 10, 2026 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant