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.
Quick navigation:
- Want to contribute? See Contributing
- Looking for detailed documentation? Navigate to docs/README.md
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:
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.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hsync_common-1.0.3.tar.gz | 180.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hsync_common-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 400.9 kB
Release files / hsync_common-1.0.3.tar.gz
| Download URL | hsync_common-1.0.3.tar.gz |
|---|---|
| Size | 180.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
554368627daf21f80900a4bf9ce02ad5d40a702883efa58cf7de0bbafe238bbd
|
|
BLAKE2b-256 checksum How to use checksums |
633cfc64639d4db829e5753d2b1e66a536fea5e398c0a1a20166646dc8c3eb70
|
| 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 13, 2026.
Transparency logRelease files / hsync_common-1.0.3-py3-none-any.whl
| Download URL | hsync_common-1.0.3-py3-none-any.whl |
|---|---|
| Size | 220.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7627ff97ef5af7c82e2743301b59f0225deef177d9ce80a4d431ac0e44bb810f
|
|
BLAKE2b-256 checksum How to use checksums |
f6bc5ae59ae7b34e5c103d49c6a8cae02214465d9ab4560925ca1bca8175e000
|
| 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 13, 2026.
Transparency log