Skip to main content

accordsync-core

Accord's merge core for Python: hybrid logical clocks, operations and the four merge strategies.

Pure Python, no I/O, no dependencies. Most programs use the client accordsync or the server accordsync-server, which depend on it. Python 3.11+.

pip install accordsync-core
Strategy Merges by
lww() Highest hybrid logical clock wins.
counter() Sum of every increment; none is ever lost.
set_() Add-wins set: a remove only removes what its writer had seen.
conflict() Concurrent values are all kept and the field is flagged; a resolution supersedes exactly the values its writer saw.

set_() has a trailing underscore so it does not shadow Python's set.

import time

from accordsync_core import LocalWriter, conflict, counter, define_schema

schema = define_schema({"dossier": {"visits": counter(), "status": conflict()}})


def now() -> int:
    return time.time_ns() // 1_000_000


a = LocalWriter(schema, "phone-a", now)
b = LocalWriter(schema, "phone-b", now)

# Each device writes offline...
from_a = [a.inc("dossier:1", "visits", 1), a.assign("dossier:1", "status", "approved")]
from_b = [b.inc("dossier:1", "visits", 2), b.assign("dossier:1", "status", "rejected")]

# ...then they exchange ops, in any order, as often as the network repeats them.
for op in from_b + from_b:
    a.receive(op)
for op in reversed(from_a):
    b.receive(op)

assert a.replica.snapshot() == b.replica.snapshot()
print(a.replica.read("dossier:1"))
# {'visits': 3, 'status': {'conflicted': [{'value': 'approved', 'opId': 'phone-a:2'},
#                                         {'value': 'rejected', 'opId': 'phone-b:2'}]}}

It merges byte for byte like @accordsync/core: the test suite runs the shared golden vectors in every delivery order, and random scenarios generated by the TypeScript core must produce identical snapshots here.

Docs: accord.benhattab.pro/docs/schema · Source: crossben/accordsync-python · Licence: Apache-2.0

Metadata

Release files for accordsync-core 0.3.0

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

Source distribution (sdist)

Source distribution for accordsync-core 0.3.0
File Size Uploaded
accordsync_core-0.3.0.tar.gz 27.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for accordsync-core 0.3.0
File Interpreter ABI Platform
accordsync_core-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 50.7 kB

Release files / accordsync_core-0.3.0.tar.gz

Download URL accordsync_core-0.3.0.tar.gz
Size 27.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cdc07b24451973c77f3d3de5b060bea26e76396aa430d1334fff8f04fb1729eb
BLAKE2b-256 checksum
How to use checksums
7bb1239a90403b291d3f4c86a8a618062e520fd336aacf2fdc11c61e06dfe880
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 7, 2026.

Transparency log

Release files / accordsync_core-0.3.0-py3-none-any.whl

Download URL accordsync_core-0.3.0-py3-none-any.whl
Size 23.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25ed40b8161255e745e62c2481f176b2764d08ff7186a79604766d790e2ce315
BLAKE2b-256 checksum
How to use checksums
317f7a36c06a5382d5eed674db6eb05482206de3880c07c6df827b4fcb92b9df
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 7, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.2

2 release files

0.3.1

2 release files

This release

0.3.0 This release

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