Original repository (GitHub) - Bugtracker and issues (GitHub) - PyPi package (ics) - Documentation (Read The Docs).
Ics.py is a pythonic and easy iCalendar library. Its goals are to read and write ics data in a developer friendly way.
iCalendar is a widely-used and useful format but not user friendly. Ics.py is there to give you the ability of creating and reading this format without any knowledge of it.
It should be able to parse every calendar that respects the rfc5545 and maybe some more… It also outputs rfc compliant calendars.
iCalendar (file extension .ics) is used by Google Calendar, Apple Calendar, Android and many more.
Ics.py is available for Python 3.7, 3.8, 3.9, 3.10, 3.11 and is Apache2 Licensed.
$ pip install ics
from datetime import datetime
from ics import Calendar, Event
c = Calendar()
e = Event()
e.summary = "My cool event"
e.description = "A meaningful description"
e.begin = datetime.fromisoformat('2022-06-06T12:05:23+02:00')
e.end = datetime.fromisoformat('2022-06-06T13:05:23+02:00')
c.events.append(e)
c
# Calendar(extra=Container('VCALENDAR', []), extra_params={}, version='2.0', prodid='ics.py 0.8.0-dev - http://git.io/lLljaA', scale=None, method=None, events=[Event(extra=Container('VEVENT', []), extra_params={}, timespan=EventTimespan(begin_time=datetime.datetime(2022, 6, 6, 12, 5, 23, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200))), end_time=None, duration=None, precision='second'), summary=None, uid='[email protected]', description=None, location=None, url=None, status=None, created=None, last_modified=None, dtstamp=datetime.datetime(2022, 6, 6, 19, 28, 14, 575558, tzinfo=Timezone.from_tzid('UTC')), alarms=[], attach=[], classification=None, transparent=None, organizer=None, geo=None, attendees=[], categories=[])], todos=[])
with open('my.ics', 'w') as f:
f.write(c.serialize())
More examples are available in the documentation.
All the documentation is hosted on readthedocs.org and is updated automatically at every commit.
Contribution are welcome of course! For more information and how to setup, see contributing.