Skip to content

calendaring-sync

Calendar sync state: sync tokens, object versions, change tracking, and conflict detection.

Part of the Python Calendaring Ecosystem.

Documentation Tests codecov REUSE status License: AGPL-3.0-or-later Ruff

calendaring-sync keeps the state a calendar sync needs between runs: the sync token the server last issued, a version for each object, and a local copy of what was last synced. It tells you what changed on each side and where local and remote changes conflict; your code decides what to do with each conflict. It doesn't talk to servers or run a sync loop itself: an adapter connects it to a server, whether one that ships with calendaring-sync or one you write.

Installation

pip install calendaring-sync

The example below syncs a CalDAV calendar, so it needs the caldav extra: pip install "calendaring-sync[caldav]". The install guide lists the extra each adapter that ships with calendaring-sync needs.

Usage

from caldav.davclient import DAVClient

from calendaring_sync import Replica, SQLiteStore
from calendaring_sync.adapters.caldav import CalDAVAdapter

URL = "https://caldav.example.com/"
USERNAME = "alice"
PASSWORD = "secret"

with (
    SQLiteStore("sync.db") as store,
    DAVClient(url=URL, username=USERNAME, password=PASSWORD) as client,
):
    calendar = client.get_calendars()[0]
    replica = Replica(store)
    adapter = CalDAVAdapter(replica, calendar)
    adapter.sync()

    for entry in replica.read_feed():
        print(entry.kind, entry.object_id)

See the quickstart for what this does, and the how-to guides for local edits, conflicts, the change feed, and writing an adapter of your own.

Documentation

Full documentation: https://calendaring-sync.readthedocs.io/en/stable/

Changelog

See the change log.

Contributing

See the contributing guide.

Funding

This project is funded through NGI Zero Core and the NGI Zero Commons Fund, funds established by NLnet with financial support from the European Commission's Next Generation Internet program. Learn more at the NLnet project page.

NLnet foundation logo European Commission logo NGI Zero Core logo NGI Zero Commons Fund logo

License

AGPL-3.0-or-later. See LICENSE.

Releases

Contributors

Languages