feat: 실질 Python SDK — 핵심 플로우 + 게시 파이프라인 (#230) - #1
Conversation
스켈레톤(헤더만)을 실동작 클라이언트로 실질화.
- httpx 동기 클라이언트 + 리소스 네임스페이스(auth/agents/mailboxes/messages/
threads/webhooks/domains/suppressions/attachments)
- 핵심 플로우: signup·verify / agent·mailbox / send(멱등키·예약 send_at·첨부)
/ inbox poll+ack / 라벨 add·remove / 전문검색 q / threads / approve·reject / webhook
- pydantic v2 모델(extra=allow), Page 커서 페이지네이션
- 오류 매핑: LoftBox wire shape {"error":{message,retry_after,...}} 파싱,
401/403/404/409/429/400·422 → 구체 예외, RateLimitError.retry_after_secs
- README: 미구현 langchain/crewai extras 제거(미구현 광고 금지)
- examples/quickstart.py, httpx MockTransport 단위테스트 13
- CI(ruff/mypy/pytest, py3.9+3.12) + 태그푸시 PyPI 게시(twine check, 버전검증)
codex 코드리뷰 반영: verify_signup body(email+verification_token), nested 오류
shape, domain status 전용 모델, 라벨 경로 인코딩(quote), webhook secret 명시 필드.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughThis PR introduces the initial LoftBox Python SDK: Pydantic v2 data models, a typed error hierarchy with ChangesLoftBox Python SDK — Initial Implementation
Sequence Diagram(s)sequenceDiagram
participant User
participant LoftBox
participant httpx.Client
participant LoftBoxAPI
User->>LoftBox: with LoftBox(api_key) as client
User->>LoftBox: client.messages.send(mailbox_id, to, subject, body, idempotency_key)
LoftBox->>httpx.Client: POST /v1/messages (Authorization, Idempotency-Key headers)
httpx.Client->>LoftBoxAPI: HTTP request
LoftBoxAPI-->>httpx.Client: 200 JSON or 4xx/429
httpx.Client-->>LoftBox: response
alt success
LoftBox-->>User: Message model
else 429 Rate Limit
LoftBox->>LoftBox: read Retry-After header / body
LoftBox-->>User: raise RateLimitError(retry_after_secs)
else 4xx other
LoftBox-->>User: raise typed LoftBoxError subclass
end
User->>LoftBox: client.mailboxes.poll_inbox(mailbox_id)
LoftBox->>httpx.Client: GET /v1/mailboxes/{id}/inbox
httpx.Client->>LoftBoxAPI: HTTP request
LoftBoxAPI-->>httpx.Client: {data, next_cursor}
LoftBox-->>User: Page[Message]
User->>LoftBox: client.mailboxes.ack_inbox(mailbox_id, message_ids)
LoftBox->>httpx.Client: POST /v1/mailboxes/{id}/inbox/ack
httpx.Client->>LoftBoxAPI: HTTP request
LoftBoxAPI-->>httpx.Client: 204
LoftBox-->>User: None
User->>LoftBox: exit context manager
LoftBox->>httpx.Client: close()
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
요약
loftbox-sdk-python 스켈레톤(헤더만 있던 상태)을 실동작 SDK로 실질화. 메인 레포 이슈 TheMagicTower/loftbox#230.
구현
auth / agents / mailboxes / messages / threads / webhooks / domains / suppressions / attachmentsmessages.send(멱등키·예약send_at·첨부·cc·답장) / inboxlist_inbox+ack_inbox/ 라벨add_labels·remove_label/ 전문검색list(q=...)/ threads /approve·reject/ webhook 생성extra="allow"— 서버 필드 추가에 강건),Page커서 페이지네이션{"error":{message,retry_after,...}}파싱 →AuthenticationError/PermissionError/NotFoundError/ConflictError/RateLimitError/ValidationError,RateLimitError.retry_after_secsexamples/quickstart.py, httpx MockTransport 단위테스트 13CI / 게시
.github/workflows/ci.yml— ruff(check+format) + mypy + pytest (Python 3.9, 3.12).github/workflows/publish.yml—v*태그 푸시 시 PyPI 게시. 태그-버전 일치 검증 +twine check+permissions: contents: read. 게시 권한은PYPI_API_TOKEN시크릿(레포 설정에서 주입).리뷰 (codex 적대적 코드리뷰 반영)
verify_signupbody 수정(email+verification_token— 라이브 스펙 대조)domain.status()전용DomainStatus모델(id 없음)quote(label, safe="")인코딩 + 특수문자 테스트secret명시 필드(1회 반환, 로그 금지 주석)ValidationError매핑설계 결정
🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
Documentation
Tests
Chores