Skip to content

apple_calendar

apple_calendar

Apple Calendar connector — reads directly from the macOS Calendar SQLite database.

No API calls, no OAuth, no app-specific password. Opens ~/Library/Group Containers/group.com.apple.calendar/Calendar.sqlitedb in read-only mode and yields one :class:Document per upcoming event.

Requires Full Disk Access granted to the terminal / app in System Settings → Privacy & Security → Full Disk Access.

Timestamp notes

The Calendar database stores timestamps as seconds since the Apple epoch of 2001-01-01 00:00:00 UTC (same convention as Apple Contacts).

Classes

AppleCalendarConnector

AppleCalendarConnector(db_path: str = '', days_ahead: int = _DEFAULT_DAYS_AHEAD, days_behind: int = _DEFAULT_DAYS_BEHIND)

Bases: BaseConnector

Connector that reads events from the macOS Calendar SQLite database.

PARAMETER DESCRIPTION
db_path

Path to Calendar.sqlitedb. Defaults to the system location.

TYPE: str DEFAULT: ''

days_ahead

How many days into the future to fetch (default: 7).

TYPE: int DEFAULT: _DEFAULT_DAYS_AHEAD

days_behind

How many days into the past to fetch (default: 1).

TYPE: int DEFAULT: _DEFAULT_DAYS_BEHIND

Source code in src/openjarvis/connectors/apple_calendar.py
def __init__(
    self,
    db_path: str = "",
    days_ahead: int = _DEFAULT_DAYS_AHEAD,
    days_behind: int = _DEFAULT_DAYS_BEHIND,
) -> None:
    self._db_path = Path(db_path) if db_path else _CAL_DB
    self._days_ahead = days_ahead
    self._days_behind = days_behind
    self._items_synced = 0
    self._items_total = 0
    self._last_sync: Optional[datetime] = None