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

A Python 3 module which implements rsync binary diff algorithm.

Project description

This is a fork of the pyrsync package with some changes such as:

  • The functions blockchecksums and rsyncdelta are now generators which make it easier to send through the network
  • Some unittests are added
  • Implementation changes (uses bytearray instead of a deque, faster hash lookup etc.)
  • The block size is no longer in the delta itself, it needs to be passed to the patchstream function
  • Does not use try/except for programming logic

It’s a Python 3 only package!

pyrsync2 is a Python module which implements the [rsync algorithm] [1], written in pure Python. It is not a wrapper for rsync, but a set of functions which apply full rsync functionality through Python.

The majority of the code for this module is taken from [Eric Pruitt’s post at ActiveState] [2]. It was orginally licensed under an [MIT license] [3], and this license has been kept wthout modifications.

## Installation

You need to have PIP:

$ sudo pip install pyrsync2

## Use

An example use case for this module:

# On the system containing the file that needs to be patched >>> import pyrsync2 >>> unpatched = open(“unpatched.file”, “rb”) >>> hashes = pyrsync2.blockchecksums(unpatched)

# On the remote system after having received hashes >>> import pyrsync2 >>> patchedfile = open(“patched.file”, “rb”) >>> delta = pyrsync2.rsyncdelta(patchedfile, hashes)

# System with the unpatched file after receiving delta >>> >>> save_to = open(“locally-patched.file”, “wb”) >>> pyrsync2.patchstream(unpatched, save_to, delta)

[1]: “Andrew Tridgell and Paul Mackerras. The rsync algorithm. Technical Report TR-CS-96-05, Canberra 0200 ACT, Australia, 1996.” [2]: “Rsync Algorithm (Python Recipe)” [3]: “OSI MIT License”

Release history Release notifications

This version
History Node


History Node


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 (6.9 kB) Copy SHA256 hash SHA256 Source None Jun 20, 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