bsdiff4 1.4.4


pip install bsdiff4

  Latest version

Released: Nov 20, 2026

Project Links

Meta
Author: Ilan Schnell
Requires Python: >=3.7

Classifiers

Development Status
  • 5 - Production/Stable

Intended Audience
  • Developers

Operating System
  • OS Independent

Programming Language
  • C
  • Python :: 3
  • Python :: 3.7
  • Python :: 3.8
  • Python :: 3.9
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14
  • Python :: 3.15
  • Python :: Free Threading :: 3 - Stable

Topic
  • Utilities

The code is mostly derived from cx_bsdiff (written by Anthony Tuininga, http://cx-bsdiff.sourceforge.net/). The cx_bsdiff code in turn was derived from bsdiff, the standalone utility produced for BSD which can be found at http://www.daemonology.net/bsdiff.

Key features of this package include:

  • produces and applies patches compatible with the standard bsdiff and bspatch tools

  • high-level diff and patch functions

  • an interface to the BSDIFF4 format

  • stricter validation and improved error handling of malformed patches than the standard bspatch tool; in particular overlong blocks are rejected

  • functions for creating patches from files and applying them to files

  • command-line interfaces: bsdiff4 and bspatch4 (the latter can also inspect patches using bspatch4 PATCH)

  • support for free-threaded Python

  • type hints

  • extensive tests

The bsdiff4 package defines the following high level functions:

diff(src_bytes, dst_bytes) -> bytes

Return a BSDIFF4-format patch (from src_bytes to dst_bytes) as bytes.

patch(src_bytes, patch_bytes) -> bytes

Apply the BSDIFF4-format patch_bytes to src_bytes and return the bytes.

file_diff(src_path, dst_path, patch_path) -> None

Write a BSDIFF4-format patch (from the file src_path to the file dst_path) to the file patch_path.

file_patch(src_path, dst_path, patch_path) -> None

Apply the BSDIFF4-format file patch_path to the file src_path and write the result to the file dst_path.

file_patch_inplace(path, patch_path) -> None

Apply the BSDIFF4-format file patch_path to the file path in place.

Example:

>>> import bsdiff4
>>> a = 100_000 * b'a'
>>> b = bytearray(a)
>>> b[100:106] = b' diff '
>>> p = bsdiff4.diff(a, bytes(b))
>>> len(p)
153
>>> bsdiff4.patch(a, p) == b
True

Wheel compatibility matrix

Platform CPython 3.9 CPython 3.10 CPython 3.11 CPython 3.12 CPython 3.13 CPython 3.14 CPython 3.15 CPython (additional flags: t) 3.14 CPython (additional flags: t) 3.15
macosx_10_13_x86_64
macosx_10_15_x86_64
macosx_10_9_x86_64
macosx_11_0_arm64
manylinux2014_aarch64
manylinux2014_ppc64le
manylinux2014_s390x
manylinux2014_x86_64
manylinux_2_17_aarch64
manylinux_2_17_ppc64le
manylinux_2_17_s390x
manylinux_2_17_x86_64
manylinux_2_28_aarch64
manylinux_2_28_ppc64le
manylinux_2_28_s390x
manylinux_2_28_x86_64
manylinux_2_31_riscv64
manylinux_2_39_riscv64
musllinux_1_2_aarch64
musllinux_1_2_ppc64le
musllinux_1_2_riscv64
musllinux_1_2_s390x
musllinux_1_2_x86_64
win32
win_amd64
win_arm64

Files in release

bsdiff4-1.4.4-cp310-cp310-macosx_10_9_x86_64.whl (24.7KiB)
bsdiff4-1.4.4-cp310-cp310-macosx_11_0_arm64.whl (24.6KiB)
bsdiff4-1.4.4-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (47.9KiB)
bsdiff4-1.4.4-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl (50.9KiB)
bsdiff4-1.4.4-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl (50.8KiB)
bsdiff4-1.4.4-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (46.3KiB)
bsdiff4-1.4.4-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl (46.1KiB)
bsdiff4-1.4.4-cp310-cp310-musllinux_1_2_aarch64.whl (46.7KiB)
bsdiff4-1.4.4-cp310-cp310-musllinux_1_2_ppc64le.whl (49.3KiB)
bsdiff4-1.4.4-cp310-cp310-musllinux_1_2_riscv64.whl (45.4KiB)
bsdiff4-1.4.4-cp310-cp310-musllinux_1_2_s390x.whl (48.8KiB)
bsdiff4-1.4.4-cp310-cp310-musllinux_1_2_x86_64.whl (45.9KiB)
bsdiff4-1.4.4-cp310-cp310-win32.whl (25.7KiB)
bsdiff4-1.4.4-cp310-cp310-win_amd64.whl (26.6KiB)
bsdiff4-1.4.4-cp310-cp310-win_arm64.whl (26.9KiB)
bsdiff4-1.4.4-cp311-cp311-macosx_10_9_x86_64.whl (24.7KiB)
bsdiff4-1.4.4-cp311-cp311-macosx_11_0_arm64.whl (24.6KiB)
bsdiff4-1.4.4-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (49.2KiB)
bsdiff4-1.4.4-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl (52.3KiB)
bsdiff4-1.4.4-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl (52.2KiB)
bsdiff4-1.4.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (47.7KiB)
bsdiff4-1.4.4-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl (47.3KiB)
bsdiff4-1.4.4-cp311-cp311-musllinux_1_2_aarch64.whl (48.1KiB)
bsdiff4-1.4.4-cp311-cp311-musllinux_1_2_ppc64le.whl (50.7KiB)
bsdiff4-1.4.4-cp311-cp311-musllinux_1_2_riscv64.whl (46.7KiB)
bsdiff4-1.4.4-cp311-cp311-musllinux_1_2_s390x.whl (50.2KiB)
bsdiff4-1.4.4-cp311-cp311-musllinux_1_2_x86_64.whl (47.2KiB)
bsdiff4-1.4.4-cp311-cp311-win32.whl (25.7KiB)
bsdiff4-1.4.4-cp311-cp311-win_amd64.whl (26.6KiB)
bsdiff4-1.4.4-cp311-cp311-win_arm64.whl (26.9KiB)
bsdiff4-1.4.4-cp312-cp312-macosx_10_13_x86_64.whl (24.7KiB)
bsdiff4-1.4.4-cp312-cp312-macosx_11_0_arm64.whl (24.6KiB)
bsdiff4-1.4.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (49.1KiB)
bsdiff4-1.4.4-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl (52.0KiB)
bsdiff4-1.4.4-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl (52.3KiB)
bsdiff4-1.4.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (47.7KiB)
bsdiff4-1.4.4-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl (47.3KiB)
bsdiff4-1.4.4-cp312-cp312-musllinux_1_2_aarch64.whl (48.0KiB)
bsdiff4-1.4.4-cp312-cp312-musllinux_1_2_ppc64le.whl (50.7KiB)
bsdiff4-1.4.4-cp312-cp312-musllinux_1_2_riscv64.whl (46.6KiB)
bsdiff4-1.4.4-cp312-cp312-musllinux_1_2_s390x.whl (50.2KiB)
bsdiff4-1.4.4-cp312-cp312-musllinux_1_2_x86_64.whl (47.2KiB)
bsdiff4-1.4.4-cp312-cp312-win32.whl (25.7KiB)
bsdiff4-1.4.4-cp312-cp312-win_amd64.whl (26.6KiB)
bsdiff4-1.4.4-cp312-cp312-win_arm64.whl (26.9KiB)
bsdiff4-1.4.4-cp313-cp313-macosx_10_13_x86_64.whl (24.7KiB)
bsdiff4-1.4.4-cp313-cp313-macosx_11_0_arm64.whl (24.6KiB)
bsdiff4-1.4.4-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (49.2KiB)
bsdiff4-1.4.4-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl (52.1KiB)
bsdiff4-1.4.4-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl (52.4KiB)
bsdiff4-1.4.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (47.8KiB)
bsdiff4-1.4.4-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl (47.4KiB)
bsdiff4-1.4.4-cp313-cp313-musllinux_1_2_aarch64.whl (48.1KiB)
bsdiff4-1.4.4-cp313-cp313-musllinux_1_2_ppc64le.whl (50.8KiB)
bsdiff4-1.4.4-cp313-cp313-musllinux_1_2_riscv64.whl (46.7KiB)
bsdiff4-1.4.4-cp313-cp313-musllinux_1_2_s390x.whl (50.3KiB)
bsdiff4-1.4.4-cp313-cp313-musllinux_1_2_x86_64.whl (47.3KiB)
bsdiff4-1.4.4-cp313-cp313-win32.whl (25.7KiB)
bsdiff4-1.4.4-cp313-cp313-win_amd64.whl (26.6KiB)
bsdiff4-1.4.4-cp313-cp313-win_arm64.whl (26.9KiB)
bsdiff4-1.4.4-cp314-cp314-macosx_10_15_x86_64.whl (24.7KiB)
bsdiff4-1.4.4-cp314-cp314-macosx_11_0_arm64.whl (24.6KiB)
bsdiff4-1.4.4-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (49.3KiB)
bsdiff4-1.4.4-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl (52.2KiB)
bsdiff4-1.4.4-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl (52.5KiB)
bsdiff4-1.4.4-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (48.0KiB)
bsdiff4-1.4.4-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl (47.5KiB)
bsdiff4-1.4.4-cp314-cp314-musllinux_1_2_aarch64.whl (48.3KiB)
bsdiff4-1.4.4-cp314-cp314-musllinux_1_2_ppc64le.whl (50.9KiB)
bsdiff4-1.4.4-cp314-cp314-musllinux_1_2_riscv64.whl (46.8KiB)
bsdiff4-1.4.4-cp314-cp314-musllinux_1_2_s390x.whl (50.4KiB)
bsdiff4-1.4.4-cp314-cp314-musllinux_1_2_x86_64.whl (47.4KiB)
bsdiff4-1.4.4-cp314-cp314-win32.whl (26.1KiB)
bsdiff4-1.4.4-cp314-cp314-win_amd64.whl (27.0KiB)
bsdiff4-1.4.4-cp314-cp314-win_arm64.whl (27.4KiB)
bsdiff4-1.4.4-cp314-cp314t-macosx_10_15_x86_64.whl (24.9KiB)
bsdiff4-1.4.4-cp314-cp314t-macosx_11_0_arm64.whl (24.8KiB)
bsdiff4-1.4.4-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (52.0KiB)
bsdiff4-1.4.4-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl (54.9KiB)
bsdiff4-1.4.4-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl (54.9KiB)
bsdiff4-1.4.4-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (50.4KiB)
bsdiff4-1.4.4-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl (49.5KiB)
bsdiff4-1.4.4-cp314-cp314t-musllinux_1_2_aarch64.whl (50.6KiB)
bsdiff4-1.4.4-cp314-cp314t-musllinux_1_2_ppc64le.whl (53.3KiB)
bsdiff4-1.4.4-cp314-cp314t-musllinux_1_2_riscv64.whl (48.8KiB)
bsdiff4-1.4.4-cp314-cp314t-musllinux_1_2_s390x.whl (52.8KiB)
bsdiff4-1.4.4-cp314-cp314t-musllinux_1_2_x86_64.whl (49.7KiB)
bsdiff4-1.4.4-cp314-cp314t-win32.whl (26.3KiB)
bsdiff4-1.4.4-cp314-cp314t-win_amd64.whl (27.3KiB)
bsdiff4-1.4.4-cp314-cp314t-win_arm64.whl (27.6KiB)
bsdiff4-1.4.4-cp315-cp315-macosx_10_15_x86_64.whl (24.7KiB)
bsdiff4-1.4.4-cp315-cp315-macosx_11_0_arm64.whl (24.6KiB)
bsdiff4-1.4.4-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (49.6KiB)
bsdiff4-1.4.4-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl (52.5KiB)
bsdiff4-1.4.4-cp315-cp315-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl (52.7KiB)
bsdiff4-1.4.4-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (48.2KiB)
bsdiff4-1.4.4-cp315-cp315-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl (48.1KiB)
bsdiff4-1.4.4-cp315-cp315-musllinux_1_2_aarch64.whl (48.5KiB)
bsdiff4-1.4.4-cp315-cp315-musllinux_1_2_ppc64le.whl (51.2KiB)
bsdiff4-1.4.4-cp315-cp315-musllinux_1_2_riscv64.whl (47.5KiB)
bsdiff4-1.4.4-cp315-cp315-musllinux_1_2_s390x.whl (50.7KiB)
bsdiff4-1.4.4-cp315-cp315-musllinux_1_2_x86_64.whl (47.8KiB)
bsdiff4-1.4.4-cp315-cp315-win32.whl (26.1KiB)
bsdiff4-1.4.4-cp315-cp315-win_amd64.whl (27.2KiB)
bsdiff4-1.4.4-cp315-cp315-win_arm64.whl (27.4KiB)
bsdiff4-1.4.4-cp315-cp315t-macosx_10_15_x86_64.whl (24.9KiB)
bsdiff4-1.4.4-cp315-cp315t-macosx_11_0_arm64.whl (24.8KiB)
bsdiff4-1.4.4-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (52.2KiB)
bsdiff4-1.4.4-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl (55.1KiB)
bsdiff4-1.4.4-cp315-cp315t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl (55.0KiB)
bsdiff4-1.4.4-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (50.7KiB)
bsdiff4-1.4.4-cp315-cp315t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl (50.2KiB)
bsdiff4-1.4.4-cp315-cp315t-musllinux_1_2_aarch64.whl (50.7KiB)
bsdiff4-1.4.4-cp315-cp315t-musllinux_1_2_ppc64le.whl (53.4KiB)
bsdiff4-1.4.4-cp315-cp315t-musllinux_1_2_riscv64.whl (49.5KiB)
bsdiff4-1.4.4-cp315-cp315t-musllinux_1_2_s390x.whl (53.0KiB)
bsdiff4-1.4.4-cp315-cp315t-musllinux_1_2_x86_64.whl (50.0KiB)
bsdiff4-1.4.4-cp315-cp315t-win32.whl (26.3KiB)
bsdiff4-1.4.4-cp315-cp315t-win_amd64.whl (27.5KiB)
bsdiff4-1.4.4-cp315-cp315t-win_arm64.whl (27.5KiB)
bsdiff4-1.4.4-cp39-cp39-macosx_10_9_x86_64.whl (24.7KiB)
bsdiff4-1.4.4-cp39-cp39-macosx_11_0_arm64.whl (24.6KiB)
bsdiff4-1.4.4-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (47.7KiB)
bsdiff4-1.4.4-cp39-cp39-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl (50.7KiB)
bsdiff4-1.4.4-cp39-cp39-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl (50.6KiB)
bsdiff4-1.4.4-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (46.1KiB)
bsdiff4-1.4.4-cp39-cp39-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl (45.9KiB)
bsdiff4-1.4.4-cp39-cp39-musllinux_1_2_aarch64.whl (46.5KiB)
bsdiff4-1.4.4-cp39-cp39-musllinux_1_2_ppc64le.whl (49.1KiB)
bsdiff4-1.4.4-cp39-cp39-musllinux_1_2_riscv64.whl (45.2KiB)
bsdiff4-1.4.4-cp39-cp39-musllinux_1_2_s390x.whl (48.6KiB)
bsdiff4-1.4.4-cp39-cp39-musllinux_1_2_x86_64.whl (45.7KiB)
bsdiff4-1.4.4-cp39-cp39-win32.whl (25.7KiB)
bsdiff4-1.4.4-cp39-cp39-win_amd64.whl (26.6KiB)
bsdiff4-1.4.4-cp39-cp39-win_arm64.whl (26.9KiB)
bsdiff4-1.4.4.tar.gz (22.8KiB)
No dependencies