Catalog PyPI
Back to packageRELEASE DETAILS

0.3.2

PyPI

accordsync-core

Accord's merge core: hybrid logical clocks, operations, lww, counter, set and conflict.

crdtlocal-firstoffline-firstsync
Published8 Oct 2026
Direct dependencies0
Transitive dependenciesNot calculated

README

Version 0.3.2 documentation

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
StrategyMerges 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

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 0

Native requirements
0 direct targetsNot calculated transitive count
No declared dependencies in this collected response

Declarations describe requirements; they are not a resolved dependency graph.

Distribution files

2 collected
accordsync_core-0.3.2-py3-none-any.whl

bdist_wheel · 22.97 KB · Python py3

Source file
accordsync_core-0.3.2.tar.gz

sdist · 26.57 KB · Python source

Source file

Repository

PENDING
crossben/accordsync-python

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 18:00 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:6d973fc0c90c895dc9a6738a90e2b200044bfaf8321344d5d28d61bab5fcd744

Other collected versions

View all collected versions →