/icalendar

icalendar parser library for Python

Primary LanguagePythonOtherNOASSERTION

Internet Calendaring and Scheduling (iCalendar) for Python

The icalendar package is a RFC 5545 compatible parser/generator for iCalendar files.


Homepage:https://icalendar.readthedocs.io
Code:https://github.com/collective/icalendar
Mailing list:https://github.com/collective/icalendar/issues
Dependencies:python-dateutil and pytz.
Compatible with:Python 2.7 and 3.4+
License:BSD

Python Package Version on PyPI Downloads from PyPI GitHub Actions build status for master GitHub Actions build status for 4.x Documentation Status

Quick Guide

To install the package, run:

pip install icalendar

You can open an .ics file and see all the events:

>>> import icalendar
>>> path_to_ics_file = "src/icalendar/tests/calendars/example.ics"
>>> with open(path_to_ics_file) as f:
...     calendar = icalendar.Calendar.from_ical(f.read())
>>> for event in calendar.walk('VEVENT'):
...     print(event.get("SUMMARY"))
New Year's Day
Orthodox Christmas
International Women's Day

Using this package, you can also create calendars from scratch or edit existing ones.

Versions and Compatibility

icalendar is a critical project used by many. It has been there for a long time and maintaining long-term compatibility with projects conflicts partially with providing and using the features that the latest Python versions bring.

Since we pour more effort into maintaining and developing icalendar, we split the project into two:

  • Branch 4.x with maximum compatibility to Python versions 2.7 and 3.4+, PyPy2 and PyPy3.
  • Branch master with the compatibility to Python versions 3.7+ and PyPy3.

We expect the master branch with versions 5+ receive the latest updates and features, and the 4.x branch the subset of security and bug fixes only. We recommend migrating to later Python versions and also providing feedback if you depend on the 4.x features.

Related projects

  • icalevents. It is built on top of icalendar and allows you to query iCal files and get the events happening on specific dates. It manages recurrent events as well.
  • recurring-ical-events. Library to query an ICalendar object for events happening at a certain date or within a certain time.
  • x-wr-timezone. Library to make ICalendar objects and files using the non-standard X-WR-TIMEZONE compliant with the standard (RFC 5545).