Skip to main content

Calendar integration: provider protocol, Google Calendar sync, and in-memory provider for testing

Project description

ulfblk-calendar

Calendar integration for the Bloques ecosystem. Provides a pluggable provider protocol, Google Calendar sync, and an in-memory provider for testing.

Installation

pip install ulfblk-calendar

For Google Calendar support:

pip install ulfblk-calendar[google]

Quick Start

from datetime import datetime, timedelta, timezone
from ulfblk_calendar import (
    CalendarSettings,
    InMemoryCalendarProvider,
    EventCreate,
    sync_to_calendar,
    sync_from_calendar,
)

# Create a provider (use InMemoryCalendarProvider for testing)
provider = InMemoryCalendarProvider()

# Create an event
now = datetime.now(tz=timezone.utc)
event = EventCreate(
    title="Team Standup",
    start=now + timedelta(hours=1),
    end=now + timedelta(hours=1, minutes=30),
    description="Daily standup meeting",
)

# Sync to calendar
import asyncio
created = asyncio.run(sync_to_calendar(event, provider))
print(f"Created: {created.external_id}")

# Sync from calendar
events = asyncio.run(sync_from_calendar(provider, now, now + timedelta(days=1)))
print(f"Found {len(events)} events")

Custom Providers

Implement the CalendarProvider protocol to create your own backend:

from ulfblk_calendar import CalendarProvider, CalendarEvent, EventCreate, EventUpdate
from datetime import datetime

class MyProvider:
    async def create_event(self, event: EventCreate) -> CalendarEvent: ...
    async def update_event(self, event_id: str, event: EventUpdate) -> CalendarEvent: ...
    async def delete_event(self, event_id: str) -> None: ...
    async def list_events(self, start: datetime, end: datetime) -> list[CalendarEvent]: ...

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

ulfblk_calendar-0.1.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

ulfblk_calendar-0.1.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ulfblk_calendar-0.1.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ulfblk_calendar-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b2bc1781c789c2e80eb4dfc15023d7d321eeb55038cff5b534b99239391f4063
MD5 048e83f68f68e1e0461e655c540cb000
BLAKE2b-256 93317f28220bfcd74f266b562e9ef556b8b6ee7f554f57c8f0ee9cd717af10b0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ulfblk_calendar-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ulfblk_calendar-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ddaee2307f7edecac8b00ce8f80b9a61b7b5c0f8da1c05f7121dc1a4b8076509
MD5 544cca54245b6bd3b507845e1ba2a63d
BLAKE2b-256 67d41de7d35ef05f44afceed9f02c8752ceeb0408a052e1140f4e4c2f3fc08e8

See more details on using hashes here.

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