bsdiff4
binary diff and patch using the BSDIFF4-format
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 bsdiff4uv
uv add bsdiff4poetry
poetry add bsdiff4Installing 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
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
patchParses and applies unified diff patches to…
permissive · top 15,000 on PyPI
fast-diff-match-patchWraps the C++ implementation of…
permissive · top 15,000 on PyPI
daffCompares two tables and produces a diff summary…
permissive · top 1,000 on PyPI
dictdifferDictdiffer computes and applies diffs and…
permissive · top 5,000 on PyPI
whatthepatchParses and applies patch files in multiple diff…
permissive · top 5,000 on PyPI
json-deltaComputes and applies diffs/patches between JSON…
permissive · top 15,000 on PyPI
diff-match-patchProvides diff, match, and patch algorithms for…
permissive · top 5,000 on PyPI
xmldiffxmldiff compares two XML files or trees and…
permissive · top 15,000 on PyPI
cobsEncodes and decodes data using Consistent…
permissive · top 15,000 on PyPI
jsondiffComputes structured diffs between JSON and…
permissive · top 5,000 on PyPI