Skip to main content

Round-trip iCal (RFC 5545) read + write for booking/availability calendars, in under 200 lines.

Project description

pantheon-ical

tests PyPI Python License

Round-trip iCal (RFC 5545) read + write for booking / availability calendars — in under 200 lines.

The guarantee: import busy dates from the systems that speak iCal (Airbnb, Booking.com, Google Calendar, Vrbo, …), and export your own busy dates back as a feed they import — with the same half-open date model on both sides, so a block on any channel propagates to the others without double-booking.

Extracted from PANTHEON, where it drives two-way calendar sync for the holiday-let and appointment businesses it hosts.

Most iCal libraries are large, general-purpose, and read-only. This is the small, opinionated subset you actually need to keep an availability calendar in sync — and it does the export side too, which is the half most libraries skip.

What it does

from pantheon_ical import parse_ical, build_ical, parse_ical_slots

# 1. Import: an OTA feed → busy DATE ranges (half-open, checkout day exclusive)
busy = parse_ical(text)          # [(date(2026,7,1), date(2026,7,5)), ...]  — the 1st–5th = 4 nights, 5th free

# 2. Export: your busy ranges → a VCALENDAR feed OTHER systems import
feed = build_ical(busy, uid_ns="my-listing")
#   → hand this URL to Booking.com/Airbnb "Import calendar" and your blocks propagate outward

# 3. Appointments: DATETIME slots, timezone-aware (for class/booking calendars)
slots = parse_ical_slots(text)   # [(datetime, datetime), ...]

Design choices that matter (learned against real OTA feeds)

  • Half-open intervals, checkout-day exclusive. DTSTART:20260701 .. DTEND:20260705 blocks four nights and leaves the 5th free for the next arrival — matching how every booking system models a stay.
  • RRULE recurrence is expanded around now, not DTSTART. An "every Monday since 2024" rule has a years-old start date; a naive expander would only produce historical dates and leave the live window bookable. This anchors the horizon to the present.
  • Unparseable rules fall back to the master occurrence. A recurrence syntax we don't model can never silently under-block real availability (which is what causes a double-booking) — the safe failure direction.
  • build_ical is deterministic (no wall-clock) and emits only busy dates + a fixed generic summary — so a public feed leaks no guest data, and an unchanged calendar is byte-identical (ETag/cache friendly).

Install

pip install pantheon-ical      # or copy the single pantheon_ical.py file

Depends only on python-dateutil (for RRULE expansion).

License

Apache-2.0. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pantheon_ical-0.1.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pantheon_ical-0.1.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file pantheon_ical-0.1.0.tar.gz.

File metadata

  • Download URL: pantheon_ical-0.1.0.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pantheon_ical-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ad6ba3ef32943ad4d905d7c89f917bfe00e788644572c8e074596808cb9a8224
MD5 bf9f206cabc7781f6c32ac168fea66d0
BLAKE2b-256 df508721e1c63216bd7d5fbd19275f50193c023acc49794b5fadb4863a5447b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pantheon_ical-0.1.0.tar.gz:

Publisher: publish.yml on Igfray/pantheon-ical

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pantheon_ical-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pantheon_ical-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pantheon_ical-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d02f7175e83ad078a2bb7d55083cd3c9ecf63da0ce8d84be9b2644dffeb43b1d
MD5 1ad4168e6fe8e89c9a43a420f7f81e00
BLAKE2b-256 df0be1706e0154bcbc417597ff5f3fdb6222f77cdfd711703ec5966bfb7efe26

See more details on using hashes here.

Provenance

The following attestation bundles were made for pantheon_ical-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Igfray/pantheon-ical

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page