Skip to main content

iCal Format

Description​

iCal (iCalendar) is a standard format (RFC 5545) for calendar data exchange. It's used by calendar applications like Google Calendar, Apple Calendar, and Microsoft Outlook. iCal files contain calendar events, todos, and other calendar components.

File Extensions​

  • .ical - iCalendar files
  • .ics - iCalendar files (alias)

Implementation Details​

Reading​

The iCal implementation:

  • Uses icalendar or ics library for parsing
  • Parses iCalendar format
  • Extracts calendar events (VEVENT components)
  • Converts events to dictionaries
  • Handles event properties (start, end, summary, etc.)

Writing​

Writing support:

  • Creates iCalendar format
  • Writes calendar events
  • Supports event properties

Key Features​

  • Calendar format: Designed for calendar data
  • Standard format: RFC 5545 standard
  • Event extraction: Extracts calendar events
  • Nested data: Supports complex calendar structures
  • Date handling: Properly handles dates and times

Usage​

from iterable import open_iterable

# Basic reading
with open_iterable('calendar.ics') as source:
for event in source:
print(event) # Contains event properties

# Writing
with open_iterable('output.ics', mode='w') as dest:
dest.write({
'summary': 'Meeting',
'dtstart': '20240101T120000Z',
'dtend': '20240101T130000Z'
})

Parameters​

  • encoding (str): File encoding (default: utf8)

Limitations​

  1. Dependency: Requires icalendar or ics package
  2. Calendar focus: Designed for calendar data, not general data
  3. Memory usage: Entire calendar may be loaded into memory
  4. Format complexity: Complex calendar structures may require manual handling

Compression Support​

iCal files can be compressed with all supported codecs:

  • GZip (.ics.gz)
  • BZip2 (.ics.bz2)
  • LZMA (.ics.xz)
  • LZ4 (.ics.lz4)
  • ZIP (.ics.zip)
  • Brotli (.ics.br)
  • ZStandard (.ics.zst)

Use Cases​

  • Calendar applications: Working with calendar data
  • Event management: Processing calendar events
  • Scheduling: Calendar scheduling systems
  • Data migration: Migrating calendar data

Error Handling​

  • Missing dependency: optional libraries raise ImportError with an install hint (pip install 'iterabledata[<extra>]' when an extra exists).
  • Write mode: read-only formats raise WriteNotSupportedError or ValueError when opened with mode="w".
  • Bad or unsupported input: may raise ValueError, OSError, or library-specific errors.
  • See Troubleshooting for decoding, detection, and engine issues.
  • VCF - vCard format (contact information)
  • EML - Email format