PyObjC CalendarStore Framework

12.1 · active · verified Tue Apr 14

PyObjC-framework-CalendarStore provides Python wrappers for the macOS CalendarStore framework (deprecated since macOS 10.8). It enables Python scripts to access, modify, and receive notifications for iCal data, including calendars, events, and tasks. The library releases new versions regularly, typically aligning with macOS SDK updates and Python version support, with version 12.1 being the current stable release.

Warnings

Install

Imports

Quickstart

This quickstart code demonstrates how to access the default CalendarStore, list available calendars, and print their titles and types. It requires the `pyobjc-framework-cocoa` for `NSDate` and `NSLog` functionality, which are commonly used in PyObjC applications.

import objc
from CalendarStore import CalCalendarStore
from Cocoa import NSDate, NSLog # Required for NSDate, commonly used with CalendarStore

# Get the default calendar store
store = CalCalendarStore.defaultCalendarStore()

if store:
    NSLog("Successfully connected to CalendarStore.")
    # List all calendars
    calendars = store.calendars()
    if calendars:
        NSLog(f"Found {len(calendars)} calendars:")
        for calendar in calendars:
            NSLog(f"  Name: {calendar.title()}, Type: {calendar.type()}")
    else:
        NSLog("No calendars found.")
else:
    NSLog("Failed to get default CalendarStore.")

view raw JSON →