Show HN: Calgebra – Set algebra for calendars in Python (github.com) 5 points by ashenfad 6mo ago ↗ HN
[–] ashenfad 6mo ago ↗ calgebra lets you compose calendar timelines using Python's set operators: | (union), & (intersection), - (difference), and ~ (complement).Queries are lazy—you build expressions first, then execute via slicing.Example – find when a team is free for a 2+ hour meeting: from calgebra import day_of_week, time_of_day, hours, HOUR # Define business hours weekend = day_of_week(["saturday", "sunday"], tz="US/Pacific") weekdays = ~weekend business_hours = weekdays & time_of_day(start=9*HOUR, duration=8*HOUR, tz="US/Pacific") # Team calendars (Google Calendar, .ics files, etc.) team_busy = alice | bob | charlie # One expression to find available slots free_slots = (business_hours - team_busy) & (hours >= 2) Features:- Set operations on any timeline source- Recurring patterns via RFC 5545 (dateutil under the hood)- Filter by duration, metadata, or custom properties- Google Calendar read/write- iCalendar (.ics) import/exportFwiw, I think focused DSLs are a great pairing with code-focused agents like huggingface's smol-agents or agex (my other hobby project).Video of a calgebra-enabled agent: https://youtu.be/10kG4tw0D4kWould love feedback!
[–] maomaomiumiu 6mo ago ↗ Pretty cool! A small but useful library for working with calendar intervals and schedules in Python
2 comments
[ 3.5 ms ] story [ 14.2 ms ] threadQueries are lazy—you build expressions first, then execute via slicing.
Example – find when a team is free for a 2+ hour meeting:
Features:- Set operations on any timeline source
- Recurring patterns via RFC 5545 (dateutil under the hood)
- Filter by duration, metadata, or custom properties
- Google Calendar read/write
- iCalendar (.ics) import/export
Fwiw, I think focused DSLs are a great pairing with code-focused agents like huggingface's smol-agents or agex (my other hobby project).
Video of a calgebra-enabled agent: https://youtu.be/10kG4tw0D4k
Would love feedback!