Skip to main content

HSYNC logo

HSYNC Common Library

hsync-common is the shared foundation that all other HSYNC projects build upon — data formats, compression, file exclusion rules, and security utilities. You don't install or run it directly; it's a library used by the client, server and desktop application.

New to HSYNC? Start with the HSYNC Ecosystem for an overview of the platform before using the library.

It is also the single source of truth for the open, versioned wire protocol: the shared models, JSON-Schema builders and committed fixtures live here (hsync_common.protocol, docs/protocol.md, docs/p2p-protocol.md), so every implementation speaks the same contract. The library sends no telemetry or analytics anywhere.

👉 Operational Advisory: As with any data-management software, integrators are strongly advised to validate the library's behavior against their own data and to maintain validated, independent backups in the applications built on top of it.


License: BSD 3-Clause CI Release PyPI Python 3.12+

Quick navigation:


Key modules

Module Purpose
hsync_common.models Unified File, Dir, Symlink, Event, SyncAction, TombstoneStore, delta transfer models
hsync_common.protocol Versioned wire protocol: versions, capabilities, WS auth, LAN election, pairing, JSON-Schema builders, fixtures
hsync_common.delta Rsync-style delta transfer algorithm: rolling checksum, block matching, decision heuristics
hsync_common.hashing SHA-256 computation, adaptive chunk sizing, hex digest validation
hsync_common.compression Zstandard helpers, PRECOMPRESSED_EXTENSIONS, should_compress
hsync_common.permissions Octal permission SSOT, remote permission sanitization
hsync_common.ignore .hsyncignore gitignore-style matcher (IgnoreMatcher)
hsync_common.path_validation Path safety helpers, remote-path validators
hsync_common.constants Shared constants (HSYNCKEEP_FILENAME, HSYNCIGNORE_FILENAME, HSYNCFOLDER_FILENAME, …)
hsync_common.ssl_utils Shared SSL primitives, cert fingerprinting
hsync_common.logger BaseInterceptHandler, log rotation helpers
hsync_common.clock NTP-style clock offset computation
hsync_common.format Human-readable bytes/duration formatting
hsync_common.env Environment-variable parsing helpers
hsync_common.text Text utilities (e.g. escape_loguru_markup)
hsync_common.labels ActionLabel enum, log-label colorization, two-level origin rule ([LOCAL …] / [REMOTE …])
hsync_common.runtime Container runtime detection (Docker, Podman, Kubernetes), TTY detection, cgroup resource limits
hsync_common.exceptions HSyncError base class
hsync_common.time_utils Timestamp formatting/parsing SSOT

Benchmarks

Hot-path micro-benchmarks live in bench/ — L1 only (pure in-process measurement), because the library has no process or transport of its own. Five scripts cover hashing, compression, delta transfer, .hsyncignore matching and model serialization; each accepts --count N and --json-out FILE.

cd hsync-common && .venv/bin/python bench/bench_hashing.py --count 2000

See bench/README.md for the scope of each script, the shared helpers and the measurement methodology.

Documentation

Document What it covers
Usage How to integrate hsync-common as a dependency
Models Shared data models reference
Utilities Cross-cutting utilities guide
Protocol Versioned wire protocol reference
Ignore file .hsyncignore syntax, IgnoreMatcher layers, and API
Android Mirroring How Python models are mirrored in Kotlin
Internal Architecture Shared models, utilities, and how they fit the HSYNC ecosystem
Architecture Decision Records Why the stable, cross-project decisions were made
Contributing Development setup and contribution guidelines
Report an issue Open development and bug tracking
Security Policy Supported versions and how to report vulnerabilities

Associated Ecosystem Components

The other components of the HSYNC ecosystem:

  • HSYNC Main — Umbrella repository and project overview.
  • HSYNC Server — Central sync hub: REST API, WebSocket relay, file storage.
  • HSYNC Client — CLI client: Server Mode and p2p Mode.
  • HSYNC Desktop — Desktop GUI front-end. (in development)
  • HSYNC Android — Android client app. (in development)
  • HSYNC Bootnode — Optional Internet discovery node for P2P (boot/1, no-log, RAM-only).

Security & Vulnerability Reporting

To report a vulnerability, please use GitHub's Private Vulnerability Reporting:

👉 Report a vulnerability

See our Security Policy for supported versions and hardening recommendations.

🙋‍♂️ A note from the maintainer

This project was born out of the need for a system capable of replicating the contents of a folder from a PC or Android device to a NAS, primarily for backup purposes. Several solutions were already available, but I couldn't find one that met all my requirements. This led to the somewhat questionable decision to develop one from scratch, while also providing an opportunity to gain a deeper understanding of programming languages, algorithms, frameworks, and related technologies.

Originally conceived as a hobby project, HSYNC has been under continuous development ever since. I believe it has now evolved to the point where its capabilities are comparable to those of commercial solutions, while also offering some distinctive features. As a result, it may also be suitable for deployment in certain production environments.

HSYNC is a passion project that I primarily develop and maintain in my spare time. Please keep this in mind when interacting with the project: we're all doing our best to build something great together, but this is not a paid, full-time job for any of us.

Disclaimer

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. Although the author has implemented reasonable safety measures, IN NO EVENT SHALL THE AUTHOR OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY — including, without limitation, any direct, indirect, incidental, special, exemplary, or consequential damages, loss of data, or business interruption — WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

This disclaimer supplements, and does not replace, the warranty disclaimer and limitation of liability provisions of the BSD 3-Clause License, which govern this software.

License

Distributed under the BSD 3-Clause License.

Metadata

Release files for hsync-common 1.0.2

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

Source distribution (sdist)

Source distribution for hsync-common 1.0.2
File Size Uploaded
hsync_common-1.0.2.tar.gz 180.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hsync-common 1.0.2
File Interpreter ABI Platform
hsync_common-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 400.9 kB

Release files / hsync_common-1.0.2.tar.gz

Download URL hsync_common-1.0.2.tar.gz
Size 180.3 kB
Tags Source
SHA-256 checksum
How to use checksums
74d70bafc62d95b16b449af400d23e8743ea5fb4c14d01714a0f8fc0ca6fd312
BLAKE2b-256 checksum
How to use checksums
bacc169b0af5f93c414085c99892af4628307b71b4aeec4c19673609c52c8c48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release files / hsync_common-1.0.2-py3-none-any.whl

Download URL hsync_common-1.0.2-py3-none-any.whl
Size 220.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a65be3f0b939aeb4d10a89c571d5ab928462b16499f4406064d4fc82e4f0e688
BLAKE2b-256 checksum
How to use checksums
d946ec1ddbbd98b52ea530b4508cb28b4ce41796235022034fae80aef14e0fbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release history Release notifications | RSS feed

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

This release

1.0.2 This release

2 release files

1.0.1

2 release files

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