Metadata-Version: 2.4
Name: ulfblk-calendar
Version: 0.1.0
Summary: Calendar integration: provider protocol, Google Calendar sync, and in-memory provider for testing
Project-URL: Homepage, https://github.com/abelardodiaz/web25-991-bloques-reciclables
Project-URL: Documentation, https://github.com/abelardodiaz/web25-991-bloques-reciclables/tree/main/packages/python/ulfblk-calendar
Project-URL: Repository, https://github.com/abelardodiaz/web25-991-bloques-reciclables
Project-URL: Issues, https://github.com/abelardodiaz/web25-991-bloques-reciclables/issues
Author-email: Abelardo Diaz <abelardo@bloques.dev>
License-Expression: MIT
Keywords: calendar,fastapi,google-calendar,provider,sync
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business :: Scheduling
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: ulfblk-core
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Provides-Extra: google
Requires-Dist: google-api-python-client>=2.0; extra == 'google'
Requires-Dist: google-auth-oauthlib>=1.0; extra == 'google'
Description-Content-Type: text/markdown

# ulfblk-calendar

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

## Installation

```bash
pip install ulfblk-calendar
```

For Google Calendar support:

```bash
pip install ulfblk-calendar[google]
```

## Quick Start

```python
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:

```python
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]: ...
```
