Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Python ctypes wrapper for librsync.

Project description


A SmartFile Open Source project. Read more about how SmartFile uses and contributes to Open Source software.

Travis CI Status Code Coverage Latest PyPI version Number of PyPI downloads


A ctypes wrapper for librsync. Provides signature(), delta(), and patch() functions.

There are three steps necessary to synchronize a file. Two steps are performed on the source file and one on the destination.

  1. Generate a signature for the destination file.
  2. Generate a delta for the source file (using the signature).
  3. Patch the destination file using the generated delta.

Usually, these steps involve remote systems. Here is an example of synchronizing two local files.

import librsync

# The destination file.
dst = file('Resume-v1.0.pdf', 'rb')

# The source file.
src = file('Resume-v1.2.pdf', 'rb')

# Where we will write the synchronized copy.
synced = file('Resume-latest.pdf', 'wb')

# Step 1: prepare signature of the destination file
signature = librsync.signature(dst)

# Step 2: prepare a delta of the source file
delta =, signature)

# Step 3: synchronize the files.
# In many cases, you would overwrite the destination with the result of
# synchronization. However, by default a new file is created.
librsync.patch(dst, delta, synced)


This wrapper only exposes the most common operations that librsync provides. It is not meant to be a full wrapper, but should cover most use-cases. You can easily extend this wrapper. Information about librsync is available in it’s manual which is linked below (I wish I had found this BEFORE writing this wrapper!)

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
python-librsync-0.1-5.tar.gz (5.0 kB) Copy SHA256 hash SHA256 Source None Jun 4, 2013

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page