Skip to main content
SmartFile

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

Introduction

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 = librsync.delta(src, 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)

Extending

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!)

http://rproxy.samba.org/doxygen/librsync/refman.pdf

Metadata

Release files for python-librsync 0.1-5

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

Source distribution (sdist)

Source distribution for python-librsync 0.1-5
File Size Uploaded
python-librsync-0.1-5.tar.gz 5.0 kB Details

Release files / python-librsync-0.1-5.tar.gz

Download URL python-librsync-0.1-5.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9f4fcb94f5cbffb281b2c8caafe635c0859809e3f9fddac5f1b717b10c78e776
BLAKE2b-256 checksum
How to use checksums
c341dddea6524fb9d8a8444946fc63d7b6b5bc0686e1323e0823aee2bf4cf333
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1-5 This release

1 release file

0.1-4

1 release file

0.1-3

1 release file

0.1-2

1 release file

0.1-1

1 release file

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