skillfed

bsdiff4

binary diff and patch using the BSDIFF4-format

bsdiff4 v1.2.6 424.5K downloads/30d#6,765 on PyPI145
Permissive license BSD Active released

What it is and what it does

bsdiff4 is a Python wrapper around the BSDIFF4 binary diffing algorithm, allowing you to compute compact patches between binary files or byte sequences and apply those patches to reconstruct the target. It exposes both in-memory functions (diff/patch on byte strings) and file-level operations (file_diff, file_patch, file_patch_inplace), making it useful for scenarios where you need to minimize storage or transmission overhead when distributing updates or storing multiple versions of binary data.

The package is built on C code derived from the original BSD bsdiff utility and cx_bsdiff, compiled to native extensions for performance. It has no runtime dependencies and is actively maintained; prebuilt wheels cover a broad range of platforms and Python versions, keeping installation straightforward on most systems despite the compiled nature of the code.

Use it for:

  • Generate compact update patches for software distribution, reducing bandwidth when delivering new versions.
  • Store incremental snapshots of binary files (e.g., disk images, database backups) to minimize storage overhead.
  • Implement version control or delta-sync systems for binary artifacts where diff-based storage saves significant space.
  • Transmit binary file changes over low-bandwidth connections by sending only the patch instead of the full file.
  • Create forensic or archival systems that track changes to binary data with minimal redundancy.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

bsdiff4 creates and applies binary patches in BSDIFF4 format, enabling efficient storage and transmission of differences between binary files or byte sequences.

Yes. bsdiff4 is stable (Production/Stable status), actively maintained, has no vulnerabilities, and solves a specific and well-defined problem with no runtime dependencies. The medium install friction is mitigated by broad wheel availability. Install it if you need efficient binary diffing; skip it if you only work with text or don't need delta compression.

Install

bsdiff4 on PyPI

pip

pip install bsdiff4

uv

uv add bsdiff4

poetry

poetry add bsdiff4

Installing bsdiff4

Before you install

Medium install friction due to compiled C extensions; however, prebuilt wheels are available for a wide range of Python versions and platforms (Python 3.10–3.13, macOS, Linux, Windows). Maintenance is active with a recent commit on 2026-08-07.

License in practice

BSD license is permissive, allowing commercial and private use with minimal restrictions; no copyleft obligations.

Quickstart

import bsdiff4
a = b'original data'
b = b'modified data'
patch = bsdiff4.diff(a, b)
result = bsdiff4.patch(a, patch)
assert result == b

Verify before relying

  • Whether the package supports Python 2.7 in practice despite classifiers listing it; modern Python versions are clearly supported.

Package facts

License BSD (permissive)
Python support not specified
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 541 days since the last release
Last repo commit
First released
Downloads 424,483/month — #6,765 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: bsdiff4-1.2.6-cp310-cp310-macosx_10_9_x86_64.whl; bsdiff4-1.2.6-cp310-cp310-macosx_11_0_arm64.whl; bsdiff4-1.2.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; bsdiff4-1.2.6-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; bsdiff4-1.2.6-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl; bsdiff4-1.2.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; bsdiff4-1.2.6-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl; bsdiff4-1.2.6-cp310-cp310-musllinux_1_2_aarch64.whl; bsdiff4-1.2.6-cp310-cp310-musllinux_1_2_i686.whl; bsdiff4-1.2.6-cp310-cp310-musllinux_1_2_ppc64le.whl; bsdiff4-1.2.6-cp310-cp310-musllinux_1_2_s390x.whl; bsdiff4-1.2.6-cp310-cp310-musllinux_1_2_x86_64.whl; bsdiff4-1.2.6-cp310-cp310-win32.whl; bsdiff4-1.2.6-cp310-cp310-win_amd64.whl; bsdiff4-1.2.6-cp311-cp311-macosx_10_9_x86_64.whl; bsdiff4-1.2.6-cp311-cp311-macosx_11_0_arm64.whl; bsdiff4-1.2.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; bsdiff4-1.2.6-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; bsdiff4-1.2.6-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl; bsdiff4-1.2.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: CProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Utilities

Tags

binary diff patchbsdiff formatbinary file comparisondelta compressionbinary patch generation
binary-diffingpatch-generationcompression

More Utilities packages