Skip to main content

PanSync - 百度网盘同步工具

基于 bypy 的多客户端百度网盘同步工具,支持定时同步、冲突检测和分布式锁管理。

功能特性

  • 🔄 智能同步: 基于文件哈希和时间戳的双向同步
  • 🔒 分布式锁: 防止多客户端同时操作的锁机制
  • 🗑️ 垃圾回收: 本地删除的文件移至云端 trash 目录
  • ⚙️ 灵活配置: 支持定时同步、限速、并发控制
  • 🖥️ 多客户端: 自动客户端注册和管理
  • 📊 状态管理: 二进制索引文件记录文件状态
  • 🚀 服务化: 支持 Supervisor 管理和开机自启

安装

# 克隆项目
git clone <repository-url>
cd pansync

# 安装依赖
pip install -r requirements.txt

# 安装项目
pip install -e .

配置

配置文件位于 ~/.pansync/config.yaml,首次运行会自动创建。

使用

# 启动同步服务
pansync start

# 停止同步服务
pansync stop

# 查看状态
pansync status

# 手动同步
pansync sync

架构设计

多客户端同步协议

  1. 锁获取: 客户端通过 .pansync/.config/lock.txt 获取分布式锁
  2. 索引同步: 上传本地索引到 .pansync/.index.dat
  3. 文件同步: 根据索引差异进行文件上传/下载
  4. 状态同步: 通过 .pansync/.config/.index.dat 维护文件状态

文件同步逻辑

  • 云端删除 → 本地删除
  • 本地删除 → 移至云端 trash 目录
  • 双向修改 → 冲突检测和报告

开发

# 开发模式安装
pip install -e .[dev]

# 运行测试
pytest tests/

# 代码格式化
black src/
flake8 src/

许可证

MIT License

Metadata

Release files for pansync 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pansync 0.1.0
File Size Uploaded
pansync-0.1.0.tar.gz 39.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pansync 0.1.0
File Interpreter ABI Platform
pansync-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 83.6 kB

Release files / pansync-0.1.0.tar.gz

Download URL pansync-0.1.0.tar.gz
Size 39.8 kB
Tags Source
SHA-256 checksum
How to use checksums
eb2a16483393ee4d917d2172553895dd14ba7d172c0c3e02ac94c325f09c993d
BLAKE2b-256 checksum
How to use checksums
2db572efa4683f72eef06a46245057f27019cad349821ad5d84ebf067959d39f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.11

Release files / pansync-0.1.0-py3-none-any.whl

Download URL pansync-0.1.0-py3-none-any.whl
Size 43.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2d12a63c0323bcb6b7448e89214d6b6bc81e7fa72aa130d18f559ebcb8d30a80
BLAKE2b-256 checksum
How to use checksums
76425270aae939bcaf420900149fd398f4b4052da089cd282d68930f701e6b93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.11

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page