Skip to main content

Incremental binary patch system — SHA256 diff, 7z (LZMA2) patch creation and application

Project description

acsync-core

PyPI License Python

acsync-core is an incremental binary patch system for Python. It uses SHA256 for change detection and 7z (LZMA2) for compression — ideal for distributing application updates with minimal bandwidth.

Powered by ACSync.Core (.NET) via pythonnet.

Installation

pip install acsync-core

Windows only — the underlying .NET assembly and 7za.exe are bundled for Windows x64. Requires a .NET 10 SDK or later runtime on the target machine.

Quick Start

1. Create a manifest

import acsync

# Scan directory A (v1.0) and save its manifest
manifest_a = acsync.create_manifest(r"D:\app\v1.0")
acsync.save_manifest(manifest_a, r"D:\app\manifest_v1.json")

# Scan directory B (v2.0) and save its manifest
manifest_b = acsync.create_manifest(r"D:\app\v2.0")
acsync.save_manifest(manifest_b, r"D:\app\manifest_v2.json")

2. Diff two manifests

diff = acsync.diff(manifest_a, manifest_b)
print(f"Changed: {len(diff['changed'])} files")
print(f"Deleted: {len(diff['deleted'])} files")
for f in diff["changed"]:
    print(f"  + {f['relativePath']} ({f['sha256'][:12]}...)")

3. Create a patch

acsync.create_patch(
    r"D:\app\v1.0",
    r"D:\app\v2.0",
    r"D:\app\update_patch.7z",
)

4. Apply a patch

acsync.apply_patch(
    r"D:\deployed_app",
    r"D:\app\update_patch.7z",
    exclude_extensions=[".config"],  # preserve local config files
)

API

Function Description
create_manifest(directory) Scan a directory, returns manifest dict with SHA256 per file
save_manifest(manifest, path) Save manifest dict to JSON file
load_manifest(path) Load manifest from JSON file
load_manifest_from_directory(dir) Load manifest from a directory (acsync_manifest.json)
diff(old, new) Compare two manifests, returns {changed: [...], deleted: [...]}
create_patch(old_dir, new_dir, output?) Create incremental 7z patch between two directories
apply_patch(target, patch?, exclude?) Apply patch to target directory

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

acsync_core-1.0.0.tar.gz (499.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

acsync_core-1.0.0-py3-none-any.whl (511.5 kB view details)

Uploaded Python 3

File details

Details for the file acsync_core-1.0.0.tar.gz.

File metadata

  • Download URL: acsync_core-1.0.0.tar.gz
  • Upload date:
  • Size: 499.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for acsync_core-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0e617a35ed4f35ac033c8359bd3e9e51b0c677959f47d42e02aa76a2155725f4
MD5 c22f969f2d0b46f8cad4d7c9df0509c3
BLAKE2b-256 843eb549f7cdb255968fdd55b91206b0203bf752b51afe29808e206db167ff41

See more details on using hashes here.

File details

Details for the file acsync_core-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: acsync_core-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 511.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for acsync_core-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d2fce5d25c719104c211804a62a93bc68781265da0be25492a54ec2b2188e7a3
MD5 1e4a6934f6a8d28fd05c512aabd5c217
BLAKE2b-256 72752e989a46ec61c0496abda1c14f6af2214bd770760a55132ab08f95093e35

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page