Skip to main content

calgebra 🗓️

Set algebra for calendars. Compose lazily and query efficiently.

Installation

pip install calgebra

# Or with Google Calendar support
pip install calgebra[google-calendar]

# Or with iCalendar (.ics) file support
pip install calgebra[ical]

Quick Start

from calgebra import day_of_week, time_of_day, at_tz, pprint, hours, HOUR
from itertools import islice

tz = "US/Pacific"
at = at_tz(tz)

# Team calendars
alice, bob, charlie = ...  # Timeline objects (Google Calendar, .ics files, etc.)

# Define when work happens
weekend = day_of_week(["saturday", "sunday"], tz=tz)
weekdays = ~weekend
workhours = time_of_day(start=9*HOUR, duration=8*HOUR, tz=tz)
business_hours = weekdays & workhours

# When is anyone busy?
team_busy = alice | bob | charlie

# Free slots: business hours minus busy, at least 2 hours
free_slots = (business_hours - team_busy) & (hours >= 2)

# Query January 2025
pprint(islice(free_slots[at("2025-01-01"):at("2025-02-01")], 5), tz=tz)
# 2025-01-06 14:00:00 -> 2025-01-06 17:00:00
# 2025-01-08 09:00:00 -> 2025-01-08 12:00:00
# ...

Core Features:

  • Set operations: | (union), & (intersection), - (difference), ~ (complement)
  • Lazy composition: Build complex queries, execute with slicing
  • Recurring patterns: day_of_week(), time_of_day(), recurring() (RFC 5545)
  • Interval filtering: hours >= 2, summary == "standup", custom properties
  • Google Calendar: Read/write via calgebra.gcsa
  • iCalendar (.ics): Load/save standard RFC 5545 files

→ Quick-start | Tutorial | API Reference | Google Calendar | Demo Video

License

MIT License - see LICENSE file for details.

Metadata

Release files for calgebra 0.10.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for calgebra 0.10.11
File Size Uploaded Provenance
calgebra-0.10.11.tar.gz 130.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for calgebra 0.10.11
File Interpreter ABI Platform
calgebra-0.10.11-py3-none-any.whl Python 3 none any Details

Total release size: 232.0 kB

Release files / calgebra-0.10.11.tar.gz

Download URL calgebra-0.10.11.tar.gz
Size 130.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1bd92bf24fbed4affcc5c017126a6ddecd421c5518212b569697b8d0c9e6574a
BLAKE2b-256 checksum
How to use checksums
62cec836b3f00aa03135a8910c8c04eaf80a75aada38ce02fe23ca0799b49644
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / calgebra-0.10.11-py3-none-any.whl

Download URL calgebra-0.10.11-py3-none-any.whl
Size 101.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f7a7620c6b3b95e3b15e79177b06d33cf5d5a7f73b0ac9194b3821e536c96374
BLAKE2b-256 checksum
How to use checksums
6dadf438975689de128b4894bcb4f1036cbdd705a6ac1eef8b9c1ce476d9f066
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Security for calgebra 0.10.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.10.11 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page